Opened 2 years ago
Closed 2 years ago
#29780 closed defect (fixed)
Still memory leaks with matrix operations over GF(2)
Reported by: | gh-cbe90 | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | sage-9.2 |
Component: | linear algebra | Keywords: | memory leaks |
Cc: | asante, gh-sn-d, nbruin, tmonteil, chapoton | Merged in: | |
Authors: | Travis Scrimshaw | Reviewers: | Frédéric Chapoton |
Report Upstream: | N/A | Work issues: | |
Branch: | c050f63 (Commits, GitHub, GitLab) | Commit: | c050f63986b5292814ff24de3b9e4288c3221cb0 |
Dependencies: | Stopgaps: |
Description (last modified by )
According to the ticket #26349, the bug should have been fixed in Release 9.1, but the provided code
n = 8 X = zero_vector(GF(2), n) M = zero_matrix(GF(2), n, n) for _ in range(10000000): Y = M * X
still leaks memory (using Ubuntu 18.04.4 LTS). There is no error message when trying to execute, but the memory consumption increases until the process crashes.
Change History (11)
comment:1 Changed 2 years ago by
- Cc Friedrich Wiemer added
comment:2 Changed 2 years ago by
- Cc asante added; Friedrich Wiemer removed
comment:3 Changed 2 years ago by
- Cc gh-sn-d added
comment:4 Changed 2 years ago by
It is something specific to a matrix times a vector. I don't see the leak if I do Y = M * M
.
comment:5 Changed 2 years ago by
Okay, here is the problem:
c._init(self._nrows, VS) c._entries = mzd_init(1, self._nrows)
The c._init
already allocates c._entries
. So this does a double allocation, and so the old allocation from c._init
is the leak.
comment:6 Changed 2 years ago by
- Branch set to public/matrix/memleak_mod2_matrix_vector-29780
- Commit set to c050f63986b5292814ff24de3b9e4288c3221cb0
- Priority changed from major to critical
- Status changed from new to needs_review
Here is the fix (plus one local micro-optimization).
New commits:
c050f63 | Fixing a memory leak in mat * vec over GF(2).
|
comment:7 Changed 2 years ago by
- Cc nbruin tmonteil added
- Description modified (diff)
comment:9 Changed 2 years ago by
- Reviewers set to Frédéric Chapoton
- Status changed from needs_review to positive_review
ok, but I am no expert.
comment:10 Changed 2 years ago by
Thank you.
comment:11 Changed 2 years ago by
- Branch changed from public/matrix/memleak_mod2_matrix_vector-29780 to c050f63986b5292814ff24de3b9e4288c3221cb0
- Resolution set to fixed
- Status changed from positive_review to closed
I can confirm that the leak is there. I remember checking when reviewing #26349 and did not see the leak.