On 24/03/12 02:44, Zlatin Balevsky wrote: > Wrong. Extracting the log statement into its own method and calling > that method inside the while loop still creates garbage. Stack frames > are different. >
How do you explain the results obtained from running my test code, then? Turn on -verbose:gc. testWithStackAllocation results in no GC, testWithoutStackAllocation results in lots of GC. > Read again exactly how Escape Analysis works. The objects it prevents > from creating do not appear in heap histograms. Take a "jmap -histo > <pid>" and you will see a huge number of java.lang.Integer objects in > the heap, not on the stack. > If you're still talking about your example, this is exactly consistent with my explanation, i.e. that escape analysis is NOT occurring, properly anyway. > The difference in run times of your example could be due to many > things. How many iterations did you run? It may be still in > interpreted mode. Enable -XX:+PrintCompilation and discard any > results until JIT stops printing. Done that, JIT stops printing after the 3rd iteration and results are the same thereafter. -- GPG: 4096R/5FBBDBCE https://github.com/infinity0 https://bitbucket.org/infinity0 https://launchpad.net/~infinity0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: <https://emu.freenetproject.org/pipermail/devl/attachments/20120324/ae745713/attachment.pgp>
