Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - Libsingular memory management (memory leak?)
Author Message
  Post subject:  Re: Libsingular memory management (memory leak?)  Reply with quote
Awesome, I just pulled the newest version and it indeed works nicely. Thanks a lot!
Post Posted: Thu Feb 08, 2018 8:25 pm
  Post subject:  Re: Libsingular memory management (memory leak?)  Reply with quote
The example you provide does not have a memory leak
in the current (development) version of Singular
Post Posted: Thu Feb 08, 2018 5:05 pm
  Post subject:  Re: Libsingular memory management (memory leak?)  Reply with quote
If I understand correctly theses things don't grow indefinitely (i.e. once they are initialized they stay more or less the same size depending on their current value), so that's not a problem for me.
To illustrate where I have memory building up consider the following code:
Code:
ring r = (0,a), (x), dp;
ideal i = x, x;
slimgb(i);
kill r;
memory(0);

Running this piece of code several times inside the same session expands the used memory after every repetition. Since I run code like that a lot of times in the same session I eventually run out of memory. One observation that I made is that there is no memory increase if I drop the constant 'a' in the ring definition. I also checked out other examples and I couldn't not find a pattern in which cases there is memory building up.
Post Posted: Wed Feb 07, 2018 6:00 pm
  Post subject:  Re: Libsingular memory management (memory leak?)  Reply with quote
There several things still taking memory legally:
- standard.lib is always loaded (see listvar(proc))
- the kernel introduces some variables (Top, ZZ, QQ, etc.)
- polynomials rings over ZZ/p (for p<2^15) create 2 tables of size 2*p bytes
which is cached for the next ring creation
- the last output is cached (to be accessed via _) -
this cache is cleared, if the value depends on a ring and the ring is killed.
Post Posted: Wed Feb 07, 2018 4:00 pm
  Post subject:  Libsingular memory management (memory leak?)  Reply with quote
I'm struggling with a memory clean up/possible memory leak problem. Calling simple code like
Code:
ring r = ...;
ideal i = ...;
slimgb(i);
kill r;

builds up (variable) memory (I'm checking memory(0) and also direct system output coincides with this observation), although I would expect that after "kill r" everything is cleaned up (there are no further variables and processes defined). I realized it since I'm calling code like that a lot of times inside the same (c++) session. It seems to me that memory is lost whenever something is printed (output and info/warning messages). My question though is two-fold:
Is this actually a bug in the code or I'm I forgetting to clean up something? I'm mainly interested to have this properly working through the c++ interface. (I'm using interpreter functions directly from within c++, like iiAllStart), the same memory loss happens also happens when called from the singular binary.
Or is there a way to reset the whole interpreter environment from within c++ without a full restart?

(If you're interested: I'm actually building a simple Singular interface for Mathematica via its LibraryLink function to have fast interaction with Singular. Everything except from this memory problem works like a beauty.)
Post Posted: Tue Feb 06, 2018 11:57 pm


It is currently Fri May 13, 2022 11:03 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group