help-octave
[Top][All Lists]
Advanced

[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 10:36:46 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

>     % data format [u1, u2, u3...; v1, v2, v3...]
>     [inod, ipin]=meshgrid([1:size(nodes,2)],[1:size(pin,2)]);
>     indices=[inod(:)'; ipin(:)'];
>     distances=nodes(:,indices(1,:))-pin(:,indices(2,:)); %paths from the pin
> to nodes in the domain
>     distances=sqrt(distances(1,:).^2+distances(2,:).^2); %because norm does
> not work on 2D data in set
>     proxim_is=indices(:,find(distances<=thresh)); %indices of closest
> [node;point] pairs
>     proxim_ds=distances(:,find(distances<=thresh)); %distances of the pairs
> above
> 
> BUT, after finishing this search function (with the same amount of solution
> data), the main program fails with: "out of memory or dimension too large
> for Octave's index type"

When does the main program fail, at the call of your search function
or later? Please show the line of code which fails, and indicate
involved variable sizes.

> , because I have 16Gb of RAM, and only
> 2Gb used.

How have determined how much RAM is used?

> So, the question, does Octave free (destruct) all the function local scope
> data uppon finishing the function with "endfunction" or "return"?
> Or the allocated memory is not freed and I need to manually "A=[]; clear A;"
> for every array INSIDE the function before finishing the job?

There should be no need and no use in clearing variables just before
returning from a function.

The internal design of array storage favours speed, but could cause a
waste of memory in some cases; but I'd like to have the requested
information from you first before considering if the latter could have
been the case here.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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