[Top][All Lists]

[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

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


public key id EAFE0591, e.g. on x-hkp://

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]