safe temp array size that will always prefer TLAB when created
Andy Nuss
andrew_nuss at yahoo.com
Tue Jan 20 10:22:56 UTC 2015
Hi,
I have a ctor for a class that creates a staging char[] buffer, which can be smallish, certainly, if necessary a size of 16 suffices for example.
In C++, this would be declared as a simple temporary exact sized array as a local stack variable. I wish to know what is the maximum length I can use for my char[] temp buffer, and have a reasonable guarantee that it will go into the java TLAB when constructed so that its impact on the heap is most like a hypothetical C++ small buffer on the stack.
Further, are there conditions under which hotspot would not locate the smallish array in TLAB? For example, based on whether or not the reference to the buffer is saved only in a local variable. In fact, I wish to construct a worker class that in turn constructs the small temp char[], saves it in a member, and the worker is used only in a loop and does not escape the function that creates it, so the worker reference is never kept anywhere but on the stack.
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20150120/f5b986d0/attachment.html>
More information about the hotspot-compiler-dev
mailing list