B4J Question Pi Free Memory

lip

Active Member
Licensed User
Longtime User
In B4J can I use something like GetSystemProperties("java.lang.Runtime.getRuntime.maxMemory()",0)
to get memory use info for a Raspberry Pi?

Or is there some other method? Perhaps using jPi4J?
 

lip

Active Member
Licensed User
Longtime User
Thanks for this library which I have included and started to use.

.SystemMemoryPhysicalFree is giving me typically 40 Mb free out of 923 Mb total. The 923 Mb matches the total memory shown on the Pi's Task Manager. However, the Task manager shows about 450 Mb Free. Any idea why such a large discrepancy?

.JVMemoryFree is showing 11 Mb used out of 18 Mb Total.

Finally what is .JVMemoryMax ? This gives me about 425 Mb
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
Task managers typically report memory usage in different ways than are reported to the JVM. What are you trying to accomplish?

Most of these methods have comments that describe what they do or report. JVMMemoryMax returns the max amount of memory the JVM will attempt to use. I think the best way to think of it is as the amount of memory the JVM has requested from the OS at this point. It doesn't necessarily mean that it has used all that memory. It also doesn't mean that the JVM can't request more if it needs to later on.

If you need to profile your B4J apps' memory usage in greater detail than provided in this library, I suggest you use VisualVM.
 
Upvote 0
Top