On Wed, Jul 21, 2010 at 7:59 PM, Kevin Smith k2msmith@gmail.com wrote:
Hello, What is the best way (from lisp) to to monitor the total memory allocation during runtime of a foreign library that is doing calls malloc/free ?
I think you'll have to use the same techniques you would use in plain C. See for example: http://stackoverflow.com/questions/1906228. However, your Lisp's memory management might interfere. For instance, Valgrind and SBCL don't get along at all.
You might have better luck with tools that only instrument malloc()/free() if your implementation doesn't use malloc() to allocate Lisp memory, e.g. SBCL.
what about memory size in lisp as well ?
There's CL:ROOM, and most Lisps have memory profilers. (I'm not aware of any such profilers including foreign memory usage, unfortunately.)
You might get better informed answers if you ask this question on your Lisp's mailing list.
HTH.