Java Heap space

Hello friend.
A couple of months I’m struggling to get a stable openhab running on my linux(raspberry model 2 1Gb Ram and a pc with debian) with the same problem.Java heap space!
I have both openhab with the same settings, in raspberry it only works about 3 days then I get in the log java heap space …
Initially I thought it was because of the resources in pi and then move all the openhab folder to a linux machine(pc).This time the openhab runs more days but it also reaches java heap space.
Somehow there should have some memory leak.
Anyone have this problem or any idea how to solve?

The most likely cause is in one or more addons, also possible are rules. Search the Google Group and github issues lists for possible memory-related problems with the addons you’re using. Also review your rule code to see if any objects are being accumulated over time. If your own investigation doesn’t yield clues, consider disabling addons one by one and checking heap usage after some hours of running to narrow down the leaker possibilities. I know of one likely memory leak in the KNX binding, but it would have to be a very slow leak. I can run an instance on an RPi2 with 10 addons indefinitely, with no evidence of memory leaks (but you are using a different set almost certainly).

How can I see this?
I will disable addons one by one but checking the heap usage would be great to not need to wait 3 days.
Thanks for your time.

One crude approach is to run “top” at a Raspian command line and look for the java process.

Or you could write a rule that prints out free and/or used memory in the current JVM, possibly converting code like this into Xtend and running it as a rule on an hourly cron schedule.

Another approach is to use the Systeminfo binding.

1 Like

I am struggeling with java heap space as well and tried to figure out systems info binding earlier (for a specific process).
How do I know the process ID, if it’s changing after a restart?