RFR: 8000617: It should be possible to allocate memory without the VM dying.
John Rose
john.r.rose at oracle.com
Thu Oct 11 12:32:45 PDT 2012
On Oct 11, 2012, at 5:55 AM, Nils Loodin wrote:
> Your comments on this issue are great! So here's another version that
> uses an enum instead of std::nothrow_t trickery!
>
> http://cr.openjdk.java.net/~nloodin/8000617/webrev.03/
Yes, this is better.
You introduce new occurrences of std::nothrow_t. I would rather see these new APIs use something that doesn't mention throws, because "throw" is misleading. Why not just pass the AllocFailEnum option directly?
Also consider changing existing occurrences of std::nothrow_t to use your enum. (I realize that there's a difference between statically linking to a non-exiting function, versus passing a variable option to select behavior. I think that's merely academic in our case. Someone please correct me if I'm wrong.)
There are only about 30 occurrences of std::nothrow_t in the system, all new. This is the proverbial camel's nose under the tent. We can't accept the whole camel. So let's push him back out. At least, let's not invite more of him in.
— John
More information about the hotspot-dev
mailing list