I’m seeing regular OOM with oom-kills of the java process on my raspberry pi 3 with zram.
I’ve already disabled all bindings and rules exept for my arduino-bridge using the REST-API very often.
I’ve collected a heap dump after some time before an OOM and took a look using eclipse memory analyser:
If you encounter out of memory error removing all the load from the system will not help you finding the issue. Memory profile of Java Virtual Machine is completely different during the load.
First example you have - the WeakCache is unlikely to be a trouble. The weak caches in Java means their entries are removed once they are not necessary. There are also soft caches and some variations with key/values. I do not think it is the issue.
The EMF on other hand might be issue, however if you disabled all the load from bindings and other systems then even parsed rules will get significant amount of memory.
Most often finding OOM is limited to single problem “finding what holds objects in the memory”. It is not necessary the amount of memory (see that String, int[] or long[] take a lot of it), but amount of memory plus references which doesn’t let given object to be evicted from memory. Most often it is some collection which grows over time and does not release own entries.
My suggestion to you is to bring back the load and do heap dump on out of memory error. You can do that with two additional parameters XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<directory>. Once you will collect two heap dumps you will be able to see which elements retain most of the memory.
I can also recommend you Yourkit which prints a little bit more information than Eclipse Memory Analyzer. One of greatest functions is “paths from GC roots” which allows you to find answer for above question - who holds the object reference. Once you know it finding root cause is much easier.
With regard to screenshot - the first two rows seems to hold the same data. Take a look on paths from gc roots (the tab you’ve cut) to see where these collections are created.
Yourkit has also additional column (if you scroll left) which shows you “reclaimed memory” or something like that. Try sorting objects by that column. It will show you different elements at the top. Check also paths from GC roots to see if these are managed by OH in some ways.