Closed simon-king-jena closed 15 years ago
Sorry, it is not copying a Sequence but a list. But that shouldn't matter.
... and the line J.append(q)
(that would occur, e.g., in a Groebner basis computation) is not needed either. Replacing Test(I)
by the following code triggers the leak as well:
def Test(I):
R=I.ring()
p=R.random_element()
J=list(I.reduced_basis())
while(1):
q=p.reduce(J)
The patch libsingularLeak.patch
partially solves the problem.
I observed that when a coercion error occurs an intermediately generated ideal _I
is explicitly destroyed with id_Delete(&_I,r)
. But when there is no error and the result is returned, then _I
is not deleted. But I think it should.
With the patch, the above Test(I)
still shows an increase of memory, but a rather moderate increase. So, it seems to be a partial solution of the problem, but more needs to be done.
Simon,
nice work. If you find any more issues please open a new ticket, so that this patch can be merged. I will review this patch shortly.
Cheers,
Michael
Attachment: libsingularLeak.patch.gz
Fixing the leak, after a suggestion of malb
Since the announced review of Michael didn't come yet, I hope it is ok that I changed the patch according to a suggestion of malb, without opening a new ticket.
The new patch seems to fix it completely.
Replying to @simon-king-jena:
Since the announced review of Michael didn't come yet, I hope it is ok that I changed the patch according to a suggestion of malb, without opening a new ticket.
Yep, I am testing that patch now.
The new patch seems to fix it completely.
:)
Cheers,
Michael
This patch also seems to fix the problem with sr.py consuming vast amounts of memory, but I will do some independent testing first.
Cheers,
Michael
Replying to @sagetrac-mabshoff:
This patch also seems to fix the problem with sr.py consuming vast amounts of memory, but I will do some independent testing first.
Unfortunately it doesn't fix the segfault (see #3758), but the amount of memory allocated goes down significantly already.
Cheers,
Michael
Cheers,
Michael
Valgrinds clean, passes doctests, positive review.
Cheers,
Michael
Merged in Sage 3.2alpha2
At http://groups.google.com/group/sage-support/browse_thread/thread/b997f95c1e2503e0/5db5f9e7d4c8faf2 was discussion about a memory leak. I found a reasonably short bit of code that triggers the leak.
In
test.pyx
:Apparently the memory consumption should not grow, since
J
returns to its original state after finishing thefor
loop. However, the followingSage
session is leaking (i.e., the memory consumption grows rapidly, and after a few seconds 1GB are filled up):The
while
loop comprisesJ0
) ofMPolynomial_libsingular
MPolynomial_libsingular
In one of these three steps must be the leak. I suspect it is the reduction and will try to verify it.
Component: commutative algebra
Keywords: memory leak libsingular
Issue created by migration from https://trac.sagemath.org/ticket/4380