Curious about program address spaces....

Started by
1 comment, last by MaulingMonkey 16 years, 10 months ago
As I understand it each application under OSs like Windows give a running application a fixed sized local address space that can never grow. I was curious how big the address space actually is under WindowsXP. Also how big is a programs stack? Doesn't this mean in theory that you could never load a mesh with x millions of traingles in one go? You would have to load part of it from disk to the heap, upload it to GPU memory, then repeat ... right?
Advertisement
Can't you configure your compiler to allocate a certain amount of memory for your program's stack?

And aren't all programs running in protected mode on an IA32 system (x86) allowed to address 4GB of memory? (This is still limited, but x must be very large if you couldn't load the contents of an x-triangle mesh into that much memory. Then again, would the data have to be in physical memory to cart off to video memory?)

(I'm interested in this topic myself. :-) )
Stack memory: A function of compile settings under Windows AFAIK, changeable in the environment under Linux AFAIK. Typical default for both is 1 MB (again AFAIK). This is where function-local variables go.

Under "32-bit" systems, you typically have 232 bytes worth of addressable space -- or 4 GiB. 1 or 2 GiB (depending on settings) of that is usually reserved for OS stuff, leaving 2-3 GiB directly addressable memory, under Windows. Other OSes may have no hard set aside portion for their OS stuff.

Typically, model data is loaded "straight" to heap, which is your general storage area (allocated with malloc/free under C, or new/delete under C++), from where it can then be sent to your graphics API for it to load to GPU. The inner loop of that copy will involve some stack, but usually a very small amount which doesn't have anything to do with triangles or other such concepts -- just bytes, words, or dwords -- whatever's most efficient for your system. EDIT: I take that back, all the stuff for copying will probably be held only in your CPU's registers.

64-bit windows is limited to something like 64 GiB 16 TiB of user-addressable memory I believe, but that's more of an OS limit than architecture. 264 bytes is around 16 EiB -- where 1 EiB = 1,024 PiB -- where 1 PiB = 1,024 TiB -- and where 1 TiB == 1,024 GiB. I can't recall if x86-64 can actually address all that, but it's somewhere in the "oh my goodness" area of things.

Regardless, GPU memory is typically smaller than general memory -- there's no reason you can't load it up and send it off all in one go.

This topic is closed to new replies.

Advertisement