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: Tatsuro MATSUOKA
Subject: Re: private scope data destruction, or GC; How it works?
Date: Thu, 19 Jan 2017 17:50:30 +0900 (JST)




----- Original Message -----
> From: hale812 
> To: help-octave
> Cc: 
> Date: 2017/1/19, Thu 17:35
> Subject: private scope data destruction, or GC; How it works?
> 
> In certain scenarios when using fast vector operations instead of manual 
> "for
> i=1:length(Array)", I am getting 
> "out of memory or dimension too large for Octave's index type"
> 
> The problem is that I am specifically reducing size of the array in some
> optimizing function.
> 
> When I build this function using "for i" statement, it works.
> 
> Then, I do almost the same using pure vector operations, in the following
> style:
>     % 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
> and so on... It allows me to find closest node not just in current
> iteration, but unique optimal nodes for the the whole set of pins, avoiding
> one iteration overlapping with/or pushing out the next iteration.
> 
> 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"
> 
> For me it looks like "stack overflow", because I have 16Gb of RAM, and 
> only
> 2Gb 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?
> 
> Is it the same for functions in the script and for functions loaded from
> file/toolbox?
> 
***************************************************************

> "out of memory or dimension too large for Octave's index type"


Please see,

http://wiki.octave.org/Enable_large_arrays:_Build_octave_such_that_it_can_use_arrays_larger_than_2Gb.


BTW, please show your OS and its version and version of octave.

Tatsuro 



reply via email to

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