[geeks] Problems with grep on leopard
John Francini
francini at mac.com
Sun Nov 18 14:31:23 CST 2007
Meanwhile, back to the original question.
I suspect that the grep tool is built 32-bit, and it's choking trying
to open a file that's 1,195,270,144 bytes in size.
You must have a HUGE file in that directory -- 1.2 (decimal)
gigabytes in size.
My suspicion is that there's enough other stuff cluttering up the
memory map of a 32-bit process that there isn't a 1.2GB hole
available to mmap() that file -- the data segment probably isn't that
big. In 32-bit processes, the user address space runs from
0x00001000 to 0x8FDFFFFF. And that is further broken into code and
data segments.
So while there is likely to be more space available than 1.2(decimal)
in the data segment, there likely isn't a single hole that large.
And that's why mmap() choked.
The process memory layout for OS X is interesting. Unlike many OSes
that map the kernel into the high 2 GB (or thereabouts) of each
process's 32-bit address space (Windows NT, VMS, Linux), Mac OS X
keeps them separate. So a jump into the kernel not only requires an
elevation of privilege, it also requires an address-space switch.
Even so, OS X does map a variety of library code and data into each
address space, which reduces the amount of arbitrarily usable virtual
memory available.
(Somehwat cribbed from Amit Singh, Mac OS X Internals: A Systems
Approach. New York: Addison-Wesley Professional)
John
On 17 Nov 2007, at 18:27, Sevan / Venture37 wrote:
> I keep on getting the following error message when running grep on my
> Application Support directory in my home directory
>
> grep(236) malloc: *** mmap(size=1195270144) failed (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
> grep: memory exhausted
>
> The system is a 8 core Mac Pro with 9GB of ram. I've tried a fresh
> install on
> another disk & still get the same thing, Apple Hardware Test says
> everything
> is fine aswell.
> Any ideas???
> _________________________________________________________________
> The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> _______________________________________________
> GEEKS: http://www.sunhelp.org/mailman/listinfo/geeks
More information about the geeks
mailing list