简体   繁体   中英

Interpreting the results of a VisualVM profiling session

I have an application that writes some data (about 15mb in 80k tuples) into an SQLite database using this jdbc-driver on Mac OS X. This is done using transactions, the largest of which contains about 45k inserts into one table. When profiling the application, several things seems strange:

  1. If I pause the application right at the beginning using System.in.read() , the memory allocated by the process keeps growing slowly. Why is that?
  2. When the application runs, the heap space used is always at around 80mb in the VisualVM monitor. However, when profiling memory usage, I get a total of about 10mb. Can anyone explain this difference?

Thanks for any help.

The jigsaw pattern in memory usage is due to the profiling results being transmitted over RMI. This is indeed very confusing and annoying to filter from real memory allocations by your program. See VisualVM profiling is polluting results to find out how to filter these :-)

With regards to your first issue, how long of a time slice did you observe the slow growth over. When memory usage is quiescent in a Java process you'll typically see a sawtooth pattern develop. Did you see any GC's occur in the same time slice? If not, then thats more evidence that supports this idea.

For problem number two, it's really hard to say for certain without more information. You would typically expect the application behaivor to differ when profiling is turned on because timing windows change, the application has to spend time reporting data and doing its normal work, etc. It could be that when profiling is turned on, more memory allocations happen because your code is now instrumented, and this triggers a GC which lowers the heap usage. Try doing a System.gc() in your application when profiling is turned off and tell us what your heap usage reports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM