Why can't more than 4GB of memory be allocated to a thread?

Fahrvergnuugen

I am the law!
I've written a PHP script that is going to assemble 122,500 200x200 images together into one giant 70,000 x 70,000 image.

When the script creates the initial blank image for it to copy the smaller pieces into, it starts allocating memory. It does this until it gets to 4.0 GB of VM (I watched the thread in top). As soon as it hits 4.0GB, it errors out with this:

*** malloc: vm_allocate(size=262144) failed with 3
*** malloc[1146]: error: Can't allocate region
FATAL: emalloc(): Unable to allocate 260000 bytes


I tried running the same program on a windows2000 server and it ran fine :rolleyes: Anybody have any ideas?
 
32 bit processors can only address 4GB of memory. There are tricks to get around it, and I'm guessing that that's what Windoze 2000 server does.
 
No it won't. Not unless you install Linux/ppc64.

I don't see how Windows could do it either unless you were using x86-64, because it's still impossible to address over 4GB no matter what kind of 32-bit CPU you have.
 
From what I have read you WILL be able to address more than 4GB of RAM to an application on a G5 (even though the OS still is only 32 bit).

I'll know for sure in a week or two, assuming my dual G5 ships by then.
 
You can address more than 4GB on a 32 bit system, but it's not native and requires some special tricks. I don't know the specifics of how it works, but it's possible.

And, the G5 can address 2^64 bits of memory, with the right OS. Apple has updated the Jaguar kernel in 10.2.8 which ships with the G5 so that it can address more than 4GB of RAM.
 
I didn't know the specifics of it, but I assumed it was possible...otherwise what would be the point of loading up the system with 8GB of ram?
 
What's the purpose of this script? Sounds interesting... I doubt you'd be able to post it, if you were even allowed.
 
Originally posted by Fahrvergnuugen
I didn't know the specifics of it, but I assumed it was possible...otherwise what would be the point of loading up the system with 8GB of ram?

No one single process can use more than 4GB at a time, but you can fit two processes using 4GB in 8GB of RAM.

(The kernel goes into 64-bit mode to set up the virtual memory. This is the only part of Panther where 64-bit addressing is directly used)
 
Back
Top