[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: private scope data destruction, or GC; How it works?
From: |
Olaf Till |
Subject: |
Re: private scope data destruction, or GC; How it works? |
Date: |
Thu, 19 Jan 2017 14:53:20 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Jan 19, 2017 at 03:13:51AM -0800, hale812 wrote:
> The function does not fail. The program executes until more sophisticated
> toolbox function is called (to be particular, that is smoothmesh from
> OpenEMS). The problem if that it fails only after I use large array
> math.
So the memory exaustion problem could indeed be related to the
following.
In current Octave, if you create arrays from a continuous part of
another array, like that:
A = rand (1, 1000000);
B = A(1:1000);
C = B(1:100);
the elements of B and C don't occupy additional memory, but reference
'slices' of A.
But if I interpret Octaves source code right, this optimization has a
prize. If you now delete A:
clear A;
all the memory of A will still be occupied as long as B or C exist
unchanged. It will only be free'd if both B and C are cleared (or if
first one of them is written into and then the other is cleared).
It is the same if A is generated within a function and B or C is
returned from the function.
I can't see a good workaround. (And it isn't sure that your problem is
indeed due to this.) I'll try to discuss this issue at the maintainers
list.
Olaf
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature
- private scope data destruction, or GC; How it works?, hale812, 2017/01/19
- Re: private scope data destruction, or GC; How it works?, Tatsuro MATSUOKA, 2017/01/19
- Re: private scope data destruction, or GC; How it works?, Olaf Till, 2017/01/19
- Re: private scope data destruction, or GC; How it works?, hale812, 2017/01/19
- Re: private scope data destruction, or GC; How it works?,
Olaf Till <=
- Re: private scope data destruction, or GC; How it works?, hale812, 2017/01/19
- Re: private scope data destruction, or GC; How it works?, Olaf Till, 2017/01/20
- Re: private scope data destruction, or GC; How it works?, hale812, 2017/01/23