[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Memory Shortage
- To: "Anthony M. Leonardo" <leonardo+@CMU.EDU>
- Subject: Re: Memory Shortage
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Fri, 6 Aug 1993 16:17:41 -0600
- Cc: info-mcl
At 1:16 PM 8/3/93 -0400, Anthony M. Leonardo wrote:
>I am writing a production system in ops5 which calls external lisp
>routines, which themselves call quickdraw routines. Somewhere, in the
>process of doing this, I am slowly using up (permanently) more and more
>space in the Mac Heap. I don't seem to be able to free up this space by
>garbage collecting. I also tried to use some heap traps (_purgemem), but
>again, no luck. So, for example, when I run this simulation, the Mac
>Heap starts out at around 250K, and when it finishes it is around 150K.
>You can see why this is a problem since if I run the program more than
>twice I run out of memory and the macintosh crashes.
I'm confused about your statement that the machine crashes after more
than two runs. MCL will grow the Mac heap if it runs out of space.
It does this by shrinking the Lisp heap, so you will eventually run
out of memory, but not until you use up the entire Lisp heap as well.
Does it really crash on the third run, even when you have plenty of
free Lisp heap available?
>I think the problem arises somewhere in using the quickdraw routines,
>because by itself, the ops5 code doesn't (shouldn't) use up any heap
>space. Although I am working with a lot of bitmaps, grafports, and
>windows, I am pretty careful about getting rid of them (using
I hope you don't mean that you are disposing of grafports & windows
with dispose-record. You need to use #_ClosePort for off-screen grafports
you make yourself, window-close for MCL windows, and #_DisposeWindow for
windows that you make yourself (I don't recommend making windows
yourself, as MCL's window system will not know they are there).
You should also note that giving a record type to dispose-record
will make it use the default storage type for that record, which
is not always correct. Never rely on default record storage types,
always be explicit.
>Any ideas about why this is happening, how to increase the Mac Heap
>size, or how to purge from the Mac Heap would be extremely helpful.
To know why this is happenning, I'd have to see your code. You
can increase the Mac heap size either by editing the LSIZ resource
with ResEdit, or with the :memory-options keyword to save-application
(documented in the MCL 2.0 release notes), or by saying
(#_DisposePtr (#_NewPtr size)) to ensure that you have "size" bytes
of contiguous space in the Mac Heap. This last mechanism will move the
boundary between the Lisp & Mac heaps, if necessary.