safe temp array size that will always prefer TLAB when created
andrew_nuss at yahoo.com
Tue Jan 20 10:22:56 UTC 2015
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-compiler-dev