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

Discussion in 'Perl Misc' started by sleepymish@gmail.com, Apr 6, 2005.

  1. Guest

    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
     
    , Apr 6, 2005
    #1
    1. Advertising

  2. Anno Siegel Guest

    <> wrote in comp.lang.perl.misc:
    > 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
     
    Anno Siegel, Apr 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vibhu
    Replies:
    4
    Views:
    548
    Chris
    Sep 29, 2004
  2. Replies:
    13
    Views:
    197
    A. Sinan Unur
    Apr 9, 2005
  3. PerlFAQ Server
    Replies:
    0
    Views:
    108
    PerlFAQ Server
    Jan 27, 2011
  4. PerlFAQ Server
    Replies:
    0
    Views:
    134
    PerlFAQ Server
    Apr 18, 2011
  5. Dilbert
    Replies:
    0
    Views:
    873
    Dilbert
    Nov 10, 2011
Loading...

Share This Page