question about Unsafe.allocateInstance
Krystal Mok
rednaxelafx at gmail.com
Fri Dec 23 16:54:16 UTC 2011
Unsafe.allocateInstance() is implemented in HotSpot VM by directly calling
JNI's AllocObject() function [1].
An object instance is allocated in the Java heap, but no constructors are
invoked for this instance.
This method is mainly used to implement BootstrapConstructorAccessorImpl in
the class library.
Li, what is your original intent for doing explicit memory management in
Java?
- Kris
[1]:
http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp16337
On Fri, Dec 23, 2011 at 7:51 PM, Florian Weimer <fweimer at bfk.de> wrote:
> * Li Li:
>
> > And I also find a method named allocateInstance, which seems what I
> > want.
>
> allocateInstance() allocates objects on the Java heap, just like new.
> I'm pretty sure that there is no way at all to allocate instances
> which are not on the Java heap and subject to garbage collection.
>
> --
> Florian Weimer <fweimer at bfk.de>
> BFK edv-consulting GmbH http://www.bfk.de/
> Kriegsstraße 100 tel: +49-721-96201-1
> D-76133 Karlsruhe fax: +49-721-96201-99
> _______________________________________________
> hotspot-gc-use mailing list
> hotspot-gc-use at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20111224/13b8ee11/attachment.htm>
-------------- next part --------------
_______________________________________________
hotspot-gc-use mailing list
hotspot-gc-use at openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
More information about the hotspot-gc-dev
mailing list