Trap memory overflow

A

alexxx.magni

I remember reading time ago that trapping memory overflow wasnt easy
in Perl.

Damn, now I have to allocate a lot of info in a 3dim structure:

my @AAA; # 1st index: image index; 2nd: x coord; 3rd: y coord
....
$AAA[$i][$x][$y]=....
....

and it surely overflows since at some time the AAA structure does not
contains my info anymore - after of course having run for some hours
without problems ...

can somebody tell me how to trap the overflow?

thanks for any help!

Alessandro
 
B

Ben Morrow

Quoth "[email protected] said:
I remember reading time ago that trapping memory overflow wasnt easy
in Perl.

No. If you must try, see $^M in perlvar, and take note of the fact that
you'll probably have to rebuild perl to use it.
Damn, now I have to allocate a lot of info in a 3dim structure:

my @AAA; # 1st index: image index; 2nd: x coord; 3rd: y coord
...
$AAA[$i][$x][$y]=....
...

and it surely overflows since at some time the AAA structure does not
contains my info anymore - after of course having run for some hours
without problems ...

That isn't memory exhaustion. Perl will exit with an untrappable error
when it runs out of memory, so you have some other problem.

Ben
 
D

Dr.Ruud

(e-mail address removed) schreef:
my @AAA; # 1st index: image index; 2nd: x coord; 3rd: y coord
...
$AAA[$i][$x][$y]=....


Is "image index" a consecutive range, starting at 0?

What is on the ...., a filename maybe? Maybe including a rather lengthy
and static path part?

Why not store the [$x,$y] as tuples?

my @aaa;

$AAA[0] = {
xy => [$x, $y ],
fn => "123.gif",
};
 
X

xhoster

I remember reading time ago that trapping memory overflow wasnt easy
in Perl.

Damn, now I have to allocate a lot of info in a 3dim structure:

my @AAA; # 1st index: image index; 2nd: x coord; 3rd: y coord
...
$AAA[$i][$x][$y]=....
...

and it surely overflows since at some time the AAA structure does not
contains my info anymore

Perl does not respond to OOM conditions by randomly deleting data.
Something else is going on.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,250
Latest member
Charlesreero

Latest Threads

Top