New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in polynomial evaluation #16411
Comments
comment:1
I am not sure if this is a problem to be reported upstream. Probably not, it seems like the culprit is on our side, in |
comment:2
Replying to @simon-king-jena:
Yep, that's my impression at least. If the caller should clean up, it's We'd presumably have to change both functions though. (I haven't looked at the modules in whole; perhaps there are more potential leaks. |
comment:4
With #18905, I get
So, I suggest to close it as a duplicate. |
Reviewer: Simon King |
comment:5
(duplicate of #18905) |
The following was reported at sage-support:
In the following I am citing Leif's comments from sage-devel:
In
singular_polynomial_call(&res, self._poly, _ring, coerced_x, MPolynomial_libsingular_get_element)
we havewhere both
next
andcoef
are pointers, andVARS
is usually zero, soexp
is an "open-ended" array, such that the effective size of the struct varies.The leak depends on the values (and the amount also on the field
and the function). My impression is also that it appears whenever
res!=NULL, i.e., the result is non-zero.
The code in singular_polynomial_call() (in
src/sage/libs/singular/polynomial.pyx) explicitly prevents Singular from
reclaiming the memory:
(
from_id.m[0]
was set to the input parameterp
, so that's ok.)Either it should make a garbage-collected copy of it (the result
ret / ret[0]) instead, or the caller has to clean up afterwards.
The docstring is quite misleading w.r.t. 'ret', as only the address of a
pointer to be changed is passed to the function, while the struct it
later points to always gets allocated by the callee, not the caller.
CC: @nexttime @malb
Component: commutative algebra
Keywords: memory leak polynomial evaluation libsingular
Reviewer: Simon King
Issue created by migration from https://trac.sagemath.org/ticket/16411
The text was updated successfully, but these errors were encountered: