help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory exaustion or size too large for index


From: Carnë Draug
Subject: Re: Memory exaustion or size too large for index
Date: Thu, 25 Feb 2010 14:44:33 -0500

2010/2/25 Jaroslav Hajek <address@hidden>:
> First, *always* state the version you're using.
> I assume it's the 3.2 series, but do not rely on undocumented defaults :)
>

Sorry. I can't believe I forgot to mention this. Yes, I'm using 3.2.2
in Ubuntu 9.10

> In 3.2.x with 32-bit indexing, the limit is 2GB of memory per array.
> The development version has this fixed and the limit is 2^31 elements
> per array (so it's 16GB for double real matrix).

That's nice to know. I can solve it by compile the development version

>
> In fact it's quite the opposite - it almost always helps to show your
> source code.
> Here, the problem is that the .* operation is not specialized for the
> integer * logical (though it certainly could be), so Octave tries to
> convert the logical operand to double, which is well over 2GB,
> although it's less than 2^31 elements. With the development version,
> this should work. Here, you can help yourself by using indexing
> instead:
>
> bg_avg = reshape (image_here, [], 1, nFrames);
> bg_avg(bg_mask, :, :) = uint8(0);
> bg_avg = squeeze (sum (bg_avg));
>
> this should also be more efficient because the mask doesn't need to be 
> expanded.
>

I'll try your code. Thanks a lot for your help, not only you solved my
problem you also made my code faster.

Carnë



reply via email to

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