I have a large program (406k) that recently started dying, very unceremoniously! No error traps were triggered even though an error handler program and a SETERR were in place. I added traces to the program, and found that it was dying at completely random places each time. This leads me to believe that it was a memory issue (ie: ran out of memory). The program runs on Linux as a cron process, and the startup environment allocates 32m of memory to all of the processes. I added a SET_PARAM 'SZ'=64000 into the routine to increase the available memory, and that seems to have resolved the problem.
However, I'd like to see if there is a better way to handle this.
The program is large since it encompasses several CALLed routines, and it will CALL itself several times using line labels. (eg: call PGN+";line_label",a$,b$,c). I suspect that each time it calls itself, a new copy of the (large) program is loaded into memory, thus using up a lot more memory. Some of the called routines also call other routines in the same program, so a call which is several levels deep could be loading several copies of the program into memory *if that is how the CALL command works*.
My question is:
- When a program CALLs itself, does it load a new copy of the program into memory?
- And if so, will using ADDR to lock the program in memory prevent a new copy of the program from being loaded into memory? (and thus reduce my need to allocate additional memory to the session)
Thanks in advance for any info you can provide!