1

I made a program in Maxima(translates it to lisp as it runs on top of lisp) that progressively solves equations. I wanted to show that in case it is not possible that all equations can be loaded in RAM and solved simultaneously, then few of them can be loaded and progressively we can add more and use the solutions from previously solved equations to get more solutions for newly added equations.

My program is working fine. But the problem is that I if I need to show that my approach will save RAM then I need to run GC before new set of equations are solved, so that I can see how minimum memory I am using, while presently compiler doesn't seem to go for GC automatically, hence it shows aggregated memory used for complete operation.

I am using Lisp implementation version: GCL 2.6.8.

I need to know how I can force garbage collection or some more effective approach someone can suggest in case its not possible to force GC in lisp(I couldn't find a way).

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
Pankaj Sejwal
  • 1,605
  • 1
  • 18
  • 27
  • You may be interested in [this question](http://stackoverflow.com/questions/4194620/current-memory-usage-in-lisp). Here is info about function [room](http://clhs.lisp.se/Body/f_room.htm). Perhaps this kind of statistical info (collected several times) might help you prove efficiency of your algorithm. – Mark Karpov Jul 02 '14 at 14:36
  • @Mark : thanks for link but I can collect from "room" itself. Is there no way I can force GC ? – Pankaj Sejwal Jul 02 '14 at 18:13
  • 1
    I would just read the GCL manual... – Rainer Joswig Jul 02 '14 at 22:25
  • @RainerJoswig : Actually I tried finding but couldn't, so I posted here. On your suggestion, I search again once more and found it "(gbc t)". I tested it with comparing "room" and I see more hole after invoking it, as I needed. – Pankaj Sejwal Jul 04 '14 at 07:05

1 Answers1

2

Grepping through the manpage of gcl I found the following(is that what you wanted?)

Function: GBC (x) Package:LISP GCL specific: Invokes the garbage collector (GC) with the collection level specified by X. NIL as the argument causes GC to collect cells only. T as the argument causes GC to collect everything.

Roman
  • 1,179
  • 6
  • 7