I can't for the life of me get the GC to work consistently so to measure the amount of memory used by instances of some class. GC just isn't predictable (spent 2 days googling it, so please if you provide references, please make sure you tried it, and it worked, or else i most likely already know about ur solution )
I'm using Java EE 5, so JVisuamVM isn't available for me.
So i thought about going JNI, starting my processes from C++ code, and getting the amount of memory they use, since i heard C++ can do that.
I have already used the JNI for "hello world" kinds of things, so i don't need a step by step intro, I would just need to know how i start another process from C++ (Something similar to Runtime.getRuntime().exec("java MyClassWithMainMethod");), and how do i get the memory used by that process.