On Mon, Jan 01, 2024 at 05:05:42PM +0100, Grégory Vanuxem wrote:
> Hello,
> 
> Can you explain this:
> 
> But in the FriCAS interpreter full manual garbage collection doesn't
> seem to work:
> 
>               Version: FriCAS 1.3.10-dev built with SBCL 2.4.0
>                  Timestamp: lun. 01 janv. 2024 15:57:35 CET
> -----------------------------------------------------------------------------
>    Issue )copyright to view copyright notices.
>    Issue )summary for a summary of useful system commands.
>    Issue )quit to leave FriCAS and return to shell.
> -----------------------------------------------------------------------------
> 
> (1) -> )lisp (room)
> 
> Dynamic space usage is:   41,776,368 bytes.  <===========
> Immobile space usage is:  24,498,176 bytes (23,440 bytes overhead).
> Read-only space usage is: 12,701,888 bytes.
> Static space usage is:         4,464 bytes.
> Control stack usage is:        1,984 bytes.
> Binding stack usage is:          368 bytes.
> Control and binding stack usage is for the current thread only.
> Garbage collection is currently enabled.
> 
> Breakdown for dynamic space:
>   12,409,920 bytes for 198,346 instance objects
>   11,857,552 bytes for  75,593 simple-vector objects
>    9,962,192 bytes for 622,637 cons objects
>    7,538,176 bytes for 100,409 other objects
> 
>   41,767,840 bytes for 996,985 dynamic objects (space total)
> 
> [snip]
> 
> ; =================================
> (1) -> a:=qnew(5000,5000)$Matrix(DoubleFloat);
> 
>                                                     Type: Matrix(DoubleFloat)
> ; =================================
> 
> (2) -> )lisp (room)
> 
> Dynamic space usage is:   241,668,128 bytes. <============
> Immobile space usage is:   24,572,528 bytes (27,120 bytes overhead).
> Read-only space usage is:  12,701,888 bytes.
> Static space usage is:          4,464 bytes.
> Control stack usage is:         1,984 bytes.
> Binding stack usage is:           368 bytes.
> Control and binding stack usage is for the current thread only.
> Garbage collection is currently enabled.
> 
> Breakdown for dynamic space:
>   212,269,600 bytes for  75,893 simple-vector objects  <=============
>    12,444,736 bytes for 199,037 instance objects
>    16,711,312 bytes for 709,352 other objects
> 
>   241,425,648 bytes for 984,282 dynamic objects (space total)
> 
> [snip]
> 
> ; ==============================================
> (2) -> )cl all
>    All user variables and function definitions have been cleared.
> (1) -> )boot $InteractiveFrame
> 
> |$InteractiveFrame|
> Value = ((NIL))
> (1) -> )lisp (sb-ext:gc :full t)
> 
> Value = NIL
> ; ===============================================
> 
> (1) -> )lisp (room)
> 
> Dynamic space usage is:   241,503,344 bytes.  <=================
> Immobile space usage is:   24,572,528 bytes (27,120 bytes overhead).
> Read-only space usage is:  12,701,888 bytes.
> Static space usage is:          4,464 bytes.
> Control stack usage is:         1,984 bytes.
> Binding stack usage is:           368 bytes.
> Control and binding stack usage is for the current thread only.
> Garbage collection is currently enabled.
> 
> Breakdown for dynamic space:
>   212,252,784 bytes for  75,885 simple-vector objects  <===========
>    12,444,416 bytes for 199,039 instance objects
>    16,707,408 bytes for 709,070 other objects
> 
>   241,404,608 bytes for 983,994 dynamic objects (space total)
> 
> [snip]
> 
> (1) ->
>
> Any idea what happens here and if this is what is expected?

FriCAS keeps current value in variables that were not cleaned.
Only after computing new value those variables were reassigned
and value could be garbage collected.

Attached patch clears relevant variables.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZZMcdp00N1YOk6ox%40fricas.org.
--- ../trunk.pp6/src/interp/i-syscmd.boot	2023-12-19 18:28:32.465255435 +0000
+++ i-syscmd.boot	2024-01-01 20:03:14.961696676 +0000
@@ -284,6 +284,7 @@
 clearCmdAll() ==
   clear_sorted_caches()
   ------undo special variables------
+  $prevCarrier := ($currentCarrier := ['carrier])
   $frameRecord := nil
   $previousBindings := nil
   untraceMapSubNames $trace_names

Reply via email to