ArrayArray BrainModular BrainModular Users Forum 2024-12-07T21:51:10+02:00 https://brainmodular.org/forums/app.php/feed/topic/7307 2024-12-07T21:51:10+02:00 2024-12-07T21:51:10+02:00 https://brainmodular.org/forums/viewtopic.php?t=7307&p=45598#p45598 <![CDATA[Re: Memory leaks in scripts]]>
But I also think the install on my live computer got corrupted. I just pulled the whole directory over from the other computer and it is working fine now. Time to make sounds!

cheers,
-e

Statistics: Posted by woodslanding — 07 Dec 2024, 20:51


]]>
2024-12-02T17:59:46+02:00 2024-12-02T17:59:46+02:00 https://brainmodular.org/forums/viewtopic.php?t=7307&p=45586#p45586 <![CDATA[Memory leaks in scripts]]>
So I have this marvellously debugged wkp doing exactly what I want, with one problem. When I transfer my wkp to my gig computer, it loads up all wrong, turns off a bunch of midi interfaces, and crashes the first time I try to load a file.

I understand now that this is because of memory leaks, and I'm trying to go through all my scripts looking for issues. The one thing that Olivier has mentioned is running off the end of an array. But I do not know what other practices might be a problem, and any further information on this would be welcome.

I will start off with a function that I imagine is an issue. I am paging through this list, but it looks like since I may remove an item partway through the process, I could try to address an element beyond the end of the list. Is this correct? I assume that the function does not stop as soon as it gets to the result line. If not, maybe this is fine. It still seems like bad form, so I am going to rewrite it:

CODE:

//// returns the data associated with a tag,//// and removes the line containing the tag from the listfunction CutLineForTag(TAG: string; list: tStringlist): string;var line: string;var i: integer;begin    for i := 0 to (list.count - 1) do    begin        //debug('checking line:' + intToStr(i) + ': ' + list.getStrings(i));        line := list.getStrings(i);        if stringsMatch(TAG, getTagForLine(line)) then        begin            result := getDataForLine(line);            list.delete(i);            debug('stripped ' + tag + ', value: ' + getDataForLine(line));        end;    end;end;
I was hoping if anybody else has experienced these types of problems, they could post examples of their issues here... it is obviously a crucial part of script writing for Usine. As I find more, I will do so as well.

THANKS ALL!
=eric

Statistics: Posted by woodslanding — 02 Dec 2024, 16:59


]]>
BrainModular BrainModular Users Forum 2024-12-07T21:51:10+02:00 https://brainmodular.org/forums/app.php/feed/topic/7307 2024-12-07T21:51:10+02:00 2024-12-07T21:51:10+02:00 https://brainmodular.org/forums/viewtopic.php?t=7307&p=45598#p45598 <![CDATA[Re: Memory leaks in scripts]]>
But I also think the install on my live computer got corrupted. I just pulled the whole directory over from the other computer and it is working fine now. Time to make sounds!

cheers,
-e

Statistics: Posted by woodslanding — 07 Dec 2024, 20:51


]]>
2024-12-02T17:59:46+02:00 2024-12-02T17:59:46+02:00 https://brainmodular.org/forums/viewtopic.php?t=7307&p=45586#p45586 <![CDATA[Memory leaks in scripts]]>
So I have this marvellously debugged wkp doing exactly what I want, with one problem. When I transfer my wkp to my gig computer, it loads up all wrong, turns off a bunch of midi interfaces, and crashes the first time I try to load a file.

I understand now that this is because of memory leaks, and I'm trying to go through all my scripts looking for issues. The one thing that Olivier has mentioned is running off the end of an array. But I do not know what other practices might be a problem, and any further information on this would be welcome.

I will start off with a function that I imagine is an issue. I am paging through this list, but it looks like since I may remove an item partway through the process, I could try to address an element beyond the end of the list. Is this correct? I assume that the function does not stop as soon as it gets to the result line. If not, maybe this is fine. It still seems like bad form, so I am going to rewrite it:

CODE:

//// returns the data associated with a tag,//// and removes the line containing the tag from the listfunction CutLineForTag(TAG: string; list: tStringlist): string;var line: string;var i: integer;begin    for i := 0 to (list.count - 1) do    begin        //debug('checking line:' + intToStr(i) + ': ' + list.getStrings(i));        line := list.getStrings(i);        if stringsMatch(TAG, getTagForLine(line)) then        begin            result := getDataForLine(line);            list.delete(i);            debug('stripped ' + tag + ', value: ' + getDataForLine(line));        end;    end;end;
I was hoping if anybody else has experienced these types of problems, they could post examples of their issues here... it is obviously a crucial part of script writing for Usine. As I find more, I will do so as well.

THANKS ALL!
=eric

Statistics: Posted by woodslanding — 02 Dec 2024, 16:59


]]>