)clear complete

6 views
Skip to first unread message

Ralf Hemmecke

unread,
Nov 6, 2023, 9:06:07 AM11/6/23
to fricas-devel
I thought that ")clear complete" basically resets FriCAS to a state
which is the same like after starting a new session. Seemingly it isn't.

I had some computation with series that consumed quite some GBs. After
")clear complete" the memory monitor did not show any freeing of space.
What would I have to do to release all the space that is claimed by FriCAS?

Ralf

Qian Yun

unread,
Nov 6, 2023, 9:33:14 AM11/6/23
to fricas...@googlegroups.com
Assuming you are using SBCL. You can compare the output of
")lisp (room)" before and after ")clear complete".

I guess that SBCL can garbage collect some memory, but it will not
return all of them back to OS, instead it may keep some for future
usage.

Also FriCAS will not return to the fresh state: it loads lots of
stuff from algebra/*fasl, that memory usage can't be undone.

- Qian

Waldek Hebisch

unread,
Nov 6, 2023, 9:38:20 AM11/6/23
to fricas...@googlegroups.com
Do some computation? If you do

)lisp (room)

you should see some change. OTOH ")clear completely" does not
call garbage collector, and most memory can be reclaimed only
after garbage collection. Also, returning memory to system
is done by garbage collector, but depends on collector policy.
If garbage collector thinks that memory will be needed in near
future it may decide to keep it allocated. Also, sbcl and Clozure CL
want to have continous piece of memory without holes, so they
allocate big hunk of memory and never free it. So, at operating
system level you see large and almost constant use of virtual memory.
Use of real memory depends on system activity, basically system
will swap unused memory when it needs it. Kernel will try to
replace zero pages by reference to single page, but this may
take some time.

As long as there is avaliable memory GCL does not run garbage collector,
so nothing gets freed.

In general, it is normal that Lisp system uses more memory that
strictly needed for user data. I find GCL behaviour extreme
and do not like it. Other Lisp system try to be nicer, but
there is tradoff between use of time for memory management
and prompt release of unused memory. So it is normal that
at some moments Lisp uses much more memory than strictly
needed.
--
Waldek Hebisch

Qian Yun

unread,
Nov 6, 2023, 9:46:39 AM11/6/23
to fricas...@googlegroups.com


On 11/6/23 22:38, Waldek Hebisch wrote:
> On Mon, Nov 06, 2023 at 03:06:04PM +0100, Ralf Hemmecke wrote:
>> I thought that ")clear complete" basically resets FriCAS to a state which is
>> the same like after starting a new session. Seemingly it isn't.
>>
>> I had some computation with series that consumed quite some GBs. After
>> ")clear complete" the memory monitor did not show any freeing of space.
>> What would I have to do to release all the space that is claimed by FriCAS?
>
> Do some computation? If you do
>
> )lisp (room)
>
> you should see some change. OTOH ")clear completely" does not
> call garbage collector,

Isn't boot function "clearCmdCompletely" calls "RECLAIM" at the end?

- Qian

Waldek Hebisch

unread,
Nov 6, 2023, 9:56:49 AM11/6/23
to fricas...@googlegroups.com
Yes, I missed this.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages