[Top][All Lists]

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

Re: Memory exaustion or size too large for index

From: Jaroslav Hajek
Subject: Re: Memory exaustion or size too large for index
Date: Thu, 25 Feb 2010 11:47:08 +0100

2010/2/25 Carnë Draug <address@hidden>:
> Hi
> I'm having some problems memory. I get this error when running my program
> error: memory exhausted or requested size too large for range of
> Octave's index type -- trying to return to prompt

First, *always* state the version you're using.
I assume it's the 3.2 series, but do not rely on undocumented defaults :)

> Sure, I'm dealing with a matrix of size 300*350*1*2500 (uint8) and
> making a bunch of stuff to it. What are the limits and how can I
> increase it?

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).

> I know I have enough memory (I have a total of almost 9Gb
> although 7 are swap) and my kernel should not be limiting the
> available memory to octave (ulimit -m gives me unlimited). If I need
> to compile it from source, what options should I change to get over
> this?

--enable-64 is the configure option for 64-bit indexing. Beware it's
experimental because people still aren't using it much.

> Thanks in advance,
> Carnë
> PS: I don't think it may be necessary but here's the part of the
> program that I think is giving me the problem (
> ). From what I could see, it never
> reaches line 8.

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

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.


RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic

reply via email to

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