Opened 13 years ago
Closed 13 years ago
#177 closed bug (fixed)
memory leak when using list insert?
Reported by: | Frank Volny | Owned by: | somebody |
---|---|---|---|
Priority: | minor | Milestone: | 3-1-1 |
Component: | singular-kernel | Version: | 3-1-0 |
Keywords: | list insert | Cc: |
Description
reported on Oct 26, 2009 by Frank Volny:
I'm having problems with the insert function. I think it may be a memory leak. I have version 3-1-0 (from APT/DEB under Debian/Ubuntu? instructions). Whenever I run the following, 1.2 GB of memory "disappears". I can't find any other way of using the insert function or any way to force a garbage collection. Rerunning the following uses even more memory (some from swap space). Rerunning it a third time crashes Singular. I hope I'm not doing anything stupid and wasting your time.
Thanks in advance! frank
memory(0);
131688
memory(2);
659456
tst_mem(250); big memory leak? memory(0);
1170564448
memory(2);
1180446720
proc tst_mem(int count) {
ring R = 2,(x,y),lp; list l1; poly p1 = x; for(int j = 0; j < count; j++ ) {
p1 = x; for(int i = 0; i < 200; i++) {
l1 = list(p1) + l1; this uses practically no memory l1 = insert(l1, p1); memory leak l1 = insert(l1, p1, 0); memory leak l1 = insert(l1, p1, size(l1)); memory leak p1 = p1 * x + p1;
} while(size(l1) > 0) { l1 = delete(l1,1); }
}
}
insert (in all variants) copied instead of modified - fixed in Singular/lists.cc