sbcl howto find current memory usage

Discussion of Common Lisp

sbcl howto find current memory usage

Postby rich289 » Tue May 17, 2011 8:47 am

I want to write an after-gc-hook which can detect that we are nearing the dynamic-space-allocation limit and throw an error.
However I have not been able to find and variables or functions which will report the current dynamic space usage.
(room) prints the desired info but I need to access from a hook.

So question is which functions or variables will report memory usage?
rich289
 
Posts: 2
Joined: Tue May 17, 2011 8:40 am

Re: sbcl howto find current memory usage

Postby Duke » Tue May 17, 2011 8:48 pm

rich289 wrote:I want to write an after-gc-hook which can detect that we are nearing the dynamic-space-allocation limit and throw an error.
However I have not been able to find and variables or functions which will report the current dynamic space usage.
(room) prints the desired info but I need to access from a hook.

So question is which functions or variables will report memory usage?

I dug around in the SBCL source and managed to do this:
Code: Select all
(push #'(lambda () (print (sb-kernel::dynamic-usage))) sb-kernel::*after-gc-hooks*)
(sb-kernel::gc)


Is that about right, or am I misreading you?
"If you want to improve, be content to be thought foolish and stupid." -Epictetus
Duke
 
Posts: 38
Joined: Sat Oct 17, 2009 10:40 pm

Re: sbcl howto find current memory usage

Postby rich289 » Wed May 18, 2011 6:34 am

sb-kernel::dynamic-usage is exactly what I was looking for.
Thank you very much.
rich289
 
Posts: 2
Joined: Tue May 17, 2011 8:40 am


Return to Common Lisp

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron