Re: : [ sisc-Bugs-1091312 ] java.lang.OutOfMemoryError: Java heap space
Matthias Radestock <[email protected]> Tue, 28 Dec 2004 18:50:59 +0000
| Newsgroups | gmane.comp.java.sisc.devel |
|---|---|
| Message-ID | <[email protected]> |
Ken Anderson wrote: > To: "SourceForge.net" <[email protected]> > Subject: Re: [SISC-devel] [ sisc-Bugs-1091312 ] java.lang.OutOfMemoryError: Java heap space > Cc: [email protected] > > The out of memory occurs because of how SICP does laziness. > See http://srfi.schemers.org/srfi-45/srfi-45.html Ken, that's what I thought at first too but the problem turns out to be with the memo-proc procedure in the example. If it is changed to not remember the proc once it has been used, e.g. (define (memo-proc proc) (let ((result #f)) (lambda () (if proc (begin (set! result (proc)) (set! proc #f))) result))) then the code runs in near-constant space. SISC's general safe-for-spaceness may be one reason why that works - the compiler does capture analysis that guarantees that code does not hang on to references any longer than strictly necessary. Matthias. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/