Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codename One - Log the RAM and Storage used by an app

Tags:

codenameone

Is it possible to Log.p("amount of Ram consumed"); by an app?

And Log.p("amount of Storage used"); by an app?

like image 738
Francesco Galgani Avatar asked Nov 28 '25 12:11

Francesco Galgani


1 Answers

Yes but not reliably. Devices are pretty problematic with RAM allocations per app as they sequester memory in ways that are very unclear. Runtime.freeMemory should work with the current iOS VM and produce "something" but I'm not sure how valuable that will be.

Keep in mind that the GC in all platforms will cause issues as there is no guarantee System.gc() will do anything or how long it will take to do whatever it is that isn't guaranteed...

If you want to check memory leaks in your app I suggest using a memory profiler on the desktop. The NetBeans one works great and you can see memory growing without shrinking if you have a memory issue. You can track it down to a specific memory leak very easily.

like image 121
Shai Almog Avatar answered Nov 30 '25 04:11

Shai Almog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!