in reply to backticks and 'Cannot allocate memory'

It's funny because one of my coworkers had exactly the same problem last week.

It fails because under the hood, the backtick operator calls fork and the OS following a conservative approach, aborts the operation because it doesn't have enough memory to hold two process images that big.

The simplest workaround is to allow the kernel to do memory overcommit.

Or alternatively, you could increase the swap space on the machine.

Update:

For perl porters reading this: wouldn't it be possible to use vfork() where supported by the OS to implement qx, system or open(... | ...), etc.?

At some point in the past any decent OS got COW making vfork mostly useless, but now, machines without or with very tiny swap spaces are becoming common making vfork pertinent again!

Replies are listed 'Best First'.
Re^2: backticks and 'Cannot allocate memory'
by JavaFan (Canon) on Sep 24, 2010 at 09:53 UTC
    Stevens and Rago write in "Advanced Programming in the Unix Environment":
    The vfork function originated with 2.9BSD. Some consider the function a blemish, but all the platforms covered in this book support it. In fact, the BSD developers removed it from the 4.4BSD release, but all the open source BSD distributions that derive from 4.4BSD add support for it back into their own releases. The vfork function is marked as an obsolete interface in Version 3 of the Single UNIX Specification.
Re^2: backticks and 'Cannot allocate memory'
by poetnerd (Initiate) on Dec 09, 2016 at 18:58 UTC
    Thank you very much! This solved a mystery that had us all stumped for a week.