Release memory after script is finished

Hi,

I have a script which simply loads a bunch of data files ( csvRead() ) and draws a huge amount of data points into a single graph.

After exporting the graph to an png-file (xs2png()) I want to release all occupied memory without closing Scilab.

However that doesn’t really work:

During process Scilab occupied > 50 GB of RAM

  • close() –> to possibly free memory of the graph –> did not reduce Scilab memory usage
  • clear() –> to possible free memory of variables –> did not reduce Scilab memory usage

Working with Win11 and Scilab 2025.1.0 and using windows task manager to view memory.

Only when closing Scilab the memory is freed.

Is there any function that I am missing to set Scilab back to “init use of memory” ?

Thank you,

Philipp

Hello Philipp,

If you go to Issues · scilab / scilab · GitLab and search for the term “memory leak” you will see that many graphical internals suffer from this disease. Sometimes deleting objects at a lower level (instead of deleting the figure) partly fixes the memory problem. But there is no magic solution. If you could write a small example causing the memory leak it may help to find where the problem comes from.

S.

Hi Philipp,

I second Stephane here, please post a simple script with the same function calls (eg. graphical function, data point, xs2png, etc…).

Note: your system memory is used when available, all graphical objects are stored in the JVM, and the memory is only reclaimed when needed.

Hi,

you may find an example here: memory leak using plot (#17490) · Issues · scilab / scilab · GitLab

The example does not include all used functions such as csvRead or xs2png since I can reproduce the memory leakage using only figure, plot, drawnow, etc

My observation is, that memory is occupied noticeably when using plot and after drawnow

@ David:

the memory is only reclaimed when needed

What does this mean exactly? Scilab continues to “block” once occupied memory, even if it actually does not need it? This memory is assigned to Scilab until another software needs it?

What I experience is that Scilab starts from a different (higher) RAM level after using plot.This occurs when I run my script several times in a row without closing Scilab in between.

Thank you,

Philipp

In software using GC (in Scilab some of the graphic data are stored in Java; the rendering is using Java), the information is stored and the memory is released only when the GC decides to kick in. For more information, you can read What is Garbage Collection in Java? | IBM .

Thank you for reporting an issue. We will investigate it and determine if it is expected behaviour (the data is still needed) or if it is a memory leak.