Is it possible to define the max heap allocation for a specific new thread (considering a limit below the max heap size allotted to the JVM)?
Example: setting the VM to -Xms=24m -Xmx=48m
and programmatically set a max thread heap size of 8m
Is it possible to define the max heap allocation for a specific new thread (considering a limit below the max heap size allotted to the JVM)?
Example: setting the VM to -Xms=24m -Xmx=48m
and programmatically set a max thread heap size of 8m
No you can't, simply because heap is shared across threads by design. However if you have a stackoverflow (thread specific), there is -Xss to change the stack size. Unless you are fighting stackoverflow, you are unlikely to need to change that.
(However, if you are really needing this, you might try to do managed off-heap allocations, thus giving you back so control of how memory is used, but dealing with bytebuffers is terribly inconvenient compared to objects...)