Reputation: 6546
I have noted the following from a website: The JVM HotSpot memory is split between 3 memory spaces:
Where is the stack allocated in hotSpot JVM? In native heap?
update: another reference info: For a 64-bit VM, the C-Heap capacity = Physical server total RAM & virtual memory – Java Heap - PermGen
Upvotes: 17
Views: 2344
Reputation: 10682
If you can find access to those things in any which way, the second Sun (or Oracle it is now adays?) will put out a patch quickly.
Being able to access those sorts of things is a HUGE security risk. A lot of systems for big companies used Java. To leave a hole where it is possible to track down allocation space wouldnt be possible.
as above, MMAP will allocate space and return it for the program and space requirements needed. I do a lot of stuff with MMAP almost every day.
Maybe because i think a bit darker in how things can be used (to better protect my systems), pretty sure there would be a hot fix for it to cancel out your work, or you have Team America World Police knocking at your door suspecting you of foul acts, and in the process seize all your equipment.
Upvotes: -1
Reputation: 718678
The answer is:
It is implementation dependent.
In the implementation I looked at, the thread stack allocation was handled by the standard C native thread library, and it looked like the library was going to the OS to allocate a memory segment for the stack. So "none of the above".
You can confirm this by delving into the OpenJDK source code relevant to your platform.
UPDATE
From an old question, here is the snippet of code from pthread_create
that requests the allocation of the thread stack. This method used by the JVM thread implementation to create the native thread.
mmap(0, attr.__stacksize,
PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
As you can see, it just uses the mmap
system call to request a memory segment from the operating system. As I said in a comment, this is NOT the regular Java heap, NOT the Permgen heap, and NOT the C native heap. It is a segment of memory specifically requested from the operating system.
For reference, here's a link to the mmap syscall manual entry.
update: another reference info: For a 64-bit VM, the C-Heap capacity = Physical server total RAM & virtual memory – Java Heap - PermGen
IMO, that is an oversimplification. (And please provide a link to where you found this information ... so that we can read it in its original form.)
Upvotes: 25