[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Memory problems maybe solved



Carl,
The pgm in question is only 9k. I have one that I've used daily for years that's 19k (but has no SUbs).
This all started when I decided that my programs would become clearer, and
easier to maintain, if I divided everything up into subs, and had the
mainline essentially do:

gosub doThis
[maybe one or two lines of fiddling goes here]
gosub doThat
gosub doTheOtherThing
. . .

And it *is* clearer, but created the memory problems. At least I think it did.

Regards,
Harry
Reply to note from Harry Binswanger  Fri, 27 Mar
2015 13:42:11 -0400

> I changed all my subroutines to goto's and it seems like I have
> no more memory problems.

That's interesting, Harry. The biggest cause of out-of-mem is program
size, but your experience indicates that there may be additional
memory overhead associated with SUbs. Pushing a procedure that's
going to be called many times down into a SUb can speed up program
execution -- perhaps at the cost of greater memory usage(?). I could
see where the cost might outweigh the benefit if a program has so
many SUbs that it breaks the memory bank -- akin to "the operation
was a success, but the patient died".

--
Carl Distefano
cld@xxxxxxxx