[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Destructors & CLOS?
- Subject: Destructors & CLOS?
- From: "Mark A. Tapia" <firstname.lastname@example.org>
- Date: Mon, 12 Jul 1993 11:21:31 -0400
Michael Burks writes on Mon Jul 12 10:57:50
> I have a memory leak which causes my program to crash after ~5000
> iterations (nasty). I am attempting to make a "Free Memory" window that
> will display the amount of free memory on the Macintosh part of the
> heap. The following always returns 0, however.
> (defun maxmem ()
> (%stack-block ((var-maxmem 4))
> (#_maxmem var-maxmem)
> (%get-long var-maxmem)))
> Obviously, LISP is making the MAC OS think it has no memory.
> So how do I get the amount of free memory on the Macintosh side of the heap?
You need the #_freeMem trap.
Here is code which prints the amount of free memory on the heap in kbytes:
(defmacro heap-stats ()
(let ((var (gensym)))
`(let ((,var (require-trap #_freeMem)))
(format t "~&Mac Heap ~dK (~d)~%"
(round (/ ,var 1024)) ,var))))