How to identify memory intensive parts of your code?

edited October 2013 in How To...

Hey Everyone,

I was wondering what might be the guidelines for detecting and identifying memory intensive parts of a certain code. I realize this is a pretty general question, and I don't really expect a definitive answer just some hints and recommendations of good practice.

Thanks,

Tagged:

Answers

  • Typical How To question, moved to appropriate section...

  • Answer ✓

    Memory intensive parts of a code: look for array declarations, or array list (or hash map) constructions with lot of elements.

    Large PImage or PGraphics can be memory intensive, too!

  • Answer ✓

    You can also export your sketch, which will result in pure java code being generated for your sketch. Then you can open this pure-java sketchcode in Netbeans profiler and run an analyze it. https://netbeans.org/kb/docs/java/profiler-intro.html

    However this is advanced technique and involves learning Netbeans which is a saga in itself. However often when your sketch crashes or slows down with no obvious reason, that's the last resort.

  • Answer ✓

    Well, one can also use JVisualVM (shipped with Java's JDK, also available independently) to analyze a sketch running from the PDE.

Sign In or Register to comment.