C++, Perl Embed, and "Out of Memory during request..." Problem

S

sleepymish

Hi,

I have cygwin running on a P4 2.4 GHZ with 512 MB RAM machine. I also
have perl 5.0.8 installed with my cygwin. I wrote a C++ application
with perl embedded to do string matching for strings of about 256
characters long. When I run the program I got the following error:

Out of memory during request for 1208 bytes, total sbrk() is 393910272
bytes!

Anyone know what this error mean?

What happens is I have a huge html file, about 80MB big, and I wrote a
parser in C++ to do string matching in the html file. Because Perl has
such a powerful regular expression capability, I decided to use Perl
instead of writing my own in C++. So I use fget to get strings line by
line from the html, then use perl to find any integer values in it. My
program works fine when the html file is 20MB or less.. but craps out
when it's 80MB. BTW, I'm using STL Vector to store the strings matched
from Perl.

Anyone know what might be the problem w/ the "OUt of memory error"? I'm
trying to narrow it down to a perl or STL vector problem. After initial
searching, I saw that other people with this error usu. orginates from
perl.

Anybody encountered this problem? Knows how to fix this?


Thanks,

Michelle
 
A

Anno Siegel

Hi,

I have cygwin running on a P4 2.4 GHZ with 512 MB RAM machine. I also
have perl 5.0.8 installed with my cygwin. I wrote a C++ application
with perl embedded to do string matching for strings of about 256
characters long. When I run the program I got the following error:

Out of memory during request for 1208 bytes, total sbrk() is 393910272
bytes!

Anyone know what this error mean?

Pretty obvious, isn't it? "Total sbrk()" means it has requested
(and been granted) 393910272 bytes up to that point.
What happens is I have a huge html file, about 80MB big, and I wrote a
parser in C++ to do string matching in the html file. Because Perl has
such a powerful regular expression capability, I decided to use Perl
instead of writing my own in C++. So I use fget to get strings line by
line from the html, then use perl to find any integer values in it. My

Can't you use one or more of strchr(), strtok() and strspn() to
locate integers? Looks pretty simple to me.
program works fine when the html file is 20MB or less.. but craps out
when it's 80MB. BTW, I'm using STL Vector to store the strings matched
from Perl.

Anyone know what might be the problem w/ the "OUt of memory error"? I'm
trying to narrow it down to a perl or STL vector problem. After initial
searching, I saw that other people with this error usu. orginates from
perl.

It is easy to produce memory leaks when embedding or extending Perl.
Since you show no code, nothing more can be said.

Anno
 

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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top