collinsmith / riiablo

Diablo II remade using Java and LibGDX
http://riiablo.com
Apache License 2.0
872 stars 99 forks source link

memory usage profiling and display #80

Open collinsmith opened 4 years ago

collinsmith commented 4 years ago

LibGDX provides an interface for accessing memory usage, but this doesn't say the memory available or heap size. I implemented Runtime.getRuntime().totalMemory(), which may not work on other platforms, and other platforms may have better accessors to this kind of profiling data (e.g., android has android.os.Debug.getNativeHeapAllocatedSize(). This type of profiling needs to be abstracted on a per-platform basis.

I don't anticipate this causing an issue for a while. Checking the LibGDX backend implementations, gwt simply returns 0 for the memory usage functions and android has an android-specific return for native heap. The android stuff will become important when optimization starts to become a priority, since those devices are far less capable than desktops.