[gambit-list] Help With Memory

David Rush kumoyuki at gmail.com
Tue Sep 23 02:58:26 EDT 2008


On Mon, Sep 22, 2008 at 8:26 PM, Joel J. Adamson
<adamsonj at email.unc.edu> <adamsonj at email.unc.edu> wrote:
> I'm using up memory, to the point where my
> kernel (named after a certain Finn)
> kills the program.  Of course I had the common misconception that this
> would never happen in a Lisp-like language

You can write spaghetti code in any language. The same applies to
memory leaks :)

> concern is that there is some basic programming technique that I am
> missing.  Basically, is something failing to get garbage-collected?

After skimming your code, I see nothing obvious; however, there are
definitely some areas that deserve a closer look:

1) Your cartesian product code could potentially use *tons* of memory.
It doesn't appear to be called from anywhere, but maybe I'mm reading
your code too fast.

2) your use of call/cc in the fitness function appears gratuitous -
but again I didn't deeply read the whole recursion pattern. The thing
to remember about call/cc is that it potentially can duplicate large
portions of the stack. 9 times out of 10 you will be better off
writing your code to using explicit CPS, anyway. (Less filling! Tastes
Great!)

Have you traced this program to see where it's allocating heavily?

david
-- 
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt



More information about the Gambit-list mailing list