Skip to content
Advertisement

Tag: allocation

Does Java’s new keyword necessarily denote heap allocation?

I’m trying to write something fast, and that constantly allocates and deallocates memory, making where this memory is allocated important in terms of performance. Does allocating objects always allocate them to the heap? Does JIT compilation do fancy allocation optimization of any sort? Answer Objects allocated with new are placed on the heap, but the JIT/JVM might optimize them to

Advertisement