We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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,
Answers
Typical How To question, moved to appropriate section...
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!
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.
Well, one can also use JVisualVM (shipped with Java's JDK, also available independently) to analyze a sketch running from the PDE.