Buffer Overrun Error

Hi,

Is there any way to check the amount of free memory at run time; after launching so many applications, I start receiving Buffer errors, and I was curious what memory usage looked like for some of my applications to possibly avoid this in the future?

Thanks,
Austin

Hi Austin,

You can see the free memory with Runtime.getRuntime().freeMemory(). To get an accurate value you should explicitly call the garbage collector before (System.gc()).

You may be interested to have a look at <dependency org="com.microej.library" name="profiling" rev="[0.0.0-RC0,1.0.0-RC0[" /> (HeapProfiler.printFreeMemory(false)) will do the code explained above.

Regards,
Pierre