mnort22 has asked for the wisdom of the Perl Monks concerning the following question:

Hy there,

When invoking a compress command using backticks (tried also with system function, same error and executing in the background using &) within perl I get a out of memory error.

message from system function: Out of memory!

When running the perl script with the same set of data but without the compress the interface works fine.

So it seems that the compress causes some error. I monitored top during the interface run and saw that when the process aborted about 20-30 MB real memory was free. I tried then to compress the same set of data in another shell and it took about 1.7MB.

Just before the compress is invoked I logged top:

last pid: 24011; load averages: 4.07, 2.96, 3.31 10:54:08 221 processes: 217 sleeping, 2 running, 2 on cpu
Memory: 2048M real, 32M free, 2241M swap in use, 261M swap free


We are using version:

$ perl -version

This is perl, v5.8.0 built for sun4-solaris

Copyright 1987-2002, Larry Wall

and do not have quotas assigned to the users.

IS there a memory restriction on perl for executing system calls. the perl script should have enough memory elsewhere since in a later stage it occupies more memory than at the point it fails.


Thanks for any hints

Ben

Replies are listed 'Best First'.
Re: Out of memory invoking system calls
by hardburn (Abbot) on Oct 09, 2003 at 14:35 UTC

    There shouldn't be a memory restriction on executing external programs.

    If all you need it to compress the data, take a look at Compress::Zlib and Compress::Bzip2. Then you won't need to rely on an external program at all.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated