[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell
From: |
Nicholas Jankowski |
Subject: |
[Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell |
Date: |
Fri, 3 May 2024 01:15:58 -0400 (EDT) |
Follow-up Comment #21, bug #65669 (group octave):
regarding num2cell, maybe a better question:
if the following two cell arrays are the same:
octave:1> a = cell(10);a(:)=1;
octave:2> b = num2cell(ones(10));
octave:3> assert(a,b) ##no error
octave:4> whos
Variables visible from the current scope:
variables in scope: top scope
Attr Name Size Bytes Class
==== ==== ==== ===== =====
a 10x10 800 cell
b 10x10 800 cell
Total is 200 elements using 1600 bytes
Why does the one created by num2cell persist in occupying so much more memory,
and why is the amount released on a clear only equal to the size of the actual
data in the cell array (the same size as the amount occupied and released by
the non-num2cell one)?
see:
octave:1> memory
Octave is running on x86_64-pc-linux-gnu
System RAM: 10138252 kiB, swap: 945368 kiB
Octave RAM: 89964 kiB, virt: 442888 kiB
Free RAM: 9135308 kiB, swap: 474060 kiB
Available RAM: 9199088 kiB, total: 9673148 kiB
octave:2> a = cell(10000);a(:)=1;
octave:3> memory
Octave is running on x86_64-pc-linux-gnu
System RAM: 10138252 kiB, swap: 945368 kiB
Octave RAM: 872428 kiB, virt: 1224140 kiB
Free RAM: 8364440 kiB, swap: 474060 kiB
Available RAM: 8428228 kiB, total: 8902288 kiB
octave:4> b = num2cell(ones(10000));
octave:5> memory
Octave is running on x86_64-pc-linux-gnu
System RAM: 10138252 kiB, swap: 945368 kiB
Octave RAM: 6341060 kiB, virt: 6658448 kiB
Free RAM: 2890076 kiB, swap: 474060 kiB
Available RAM: 2953900 kiB, total: 3427960 kiB
octave:6> whos
Variables visible from the current scope:
variables in scope: top scope
Attr Name Size Bytes Class
==== ==== ==== ===== =====
a 10000x10000 800000000 cell
b 10000x10000 800000000 cell
Total is 200000000 elements using 1600000000 bytes
octave:7> clear a
octave:8> memory
Octave is running on x86_64-pc-linux-gnu
System RAM: 10138252 kiB, swap: 945368 kiB
Octave RAM: 5559964 kiB, virt: 5877196 kiB
Free RAM: 3662280 kiB, swap: 474060 kiB
Available RAM: 3726112 kiB, total: 4200172 kiB
octave:9> clear b
octave:10> memory
Octave is running on x86_64-pc-linux-gnu
System RAM: 10138252 kiB, swap: 945368 kiB
Octave RAM: 4778848 kiB, virt: 5095944 kiB
Free RAM: 4434484 kiB, swap: 474060 kiB
Available RAM: 4498324 kiB, total: 4972384 kiB
octave:11> whos
the data size is only about 800MB, and that's about the size of 'a' and the
size of the decrease in octave-held memory when clearing 'b'.
it makes sense that num2cell uses more memory to create the cell.
but every other operation I see in octave that temporarily uses more memory
for an operation releases it immediately. i switched from magic(10000) to
ones(10000) because magic has a higher temporary memory use that killed octave
when I was trying to sneak up on the process1/process2 memory limit test you
suggested. the only operation i've seen that doesn't release memory like this
after clearing data is num2cell.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65669>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, (continued)
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Nicholas Jankowski, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Arun Giridhar, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Henry Shu, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Arun Giridhar, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Nicholas Jankowski, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Arun Giridhar, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Nicholas Jankowski, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Henry Shu, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Arun Giridhar, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Arun Giridhar, 2024/05/02
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell,
Nicholas Jankowski <=
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Arun Giridhar, 2024/05/03
- [Octave-bug-tracker] [bug #65669] Memory Leak when Using Cell, Philip Nienhuis, 2024/05/03
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Arun Giridhar, 2024/05/03
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Henry Shu, 2024/05/04
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Arun Giridhar, 2024/05/04
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Henry Shu, 2024/05/04
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Petter, 2024/05/05
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Henry Shu, 2024/05/06
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Dmitri A. Sergatskov, 2024/05/06
- [Octave-bug-tracker] [bug #65669] Cell array construction is memory-intensive, Dmitri A. Sergatskov, 2024/05/06