How much RAM is too much RAM?

slifty

New member
Hello all, first time posting so I hope I'm in the right place.

I tend to (accidentally) leave mafia open for days at a time / I don't routinely close it. I've noticed that it start using unexpectedly large amounts of RAM -- one time it was up to 9 GB, right now it's at 4.34 GB.

It also often sits churning 20-30% of my CPU.

Is this normal? Anything I can do to prevent this kind of resource consumption when I'm not interacting with it?

(Note: running garbage collect "Reclaimed 218217 KB of memory")
 

Ryo_Sangnoir

Developer
Staff member
You could post this in Bug Reports, but unless you have a reproduction (other than "leave Mafia open for days"), it's going to be hard to fix.
 

fronobulax

Developer
Staff member
There are lots of anecdotes related to letting mafia run for days and then seeing weird things happen. They are somewhat hard to diagnose, debug and fix. Since Java handles garbage collection KoLmafia has not been subject to the kind of memory management scrutiny that was common in Ye Olden Days for C and C++ code with memory leaks. But there are definitely cases where KoLmafia "holds on" to memory longer than it needs to. If you have a JDK installed (and not a JRE) there are tools that can dump memory statistics while Java is running so there could be a plan to try and track this down.

But the truth is the solution "Don't do that" is acceptable. If mafia is having an impact on what else you are doing then log out of Kol and shut down mafia.

To answer your questions I would say that it is normal to the extent that anything related to leaving KoLmafia running for days is normal. I don't think there is anything you can do to prevent it, short of shutting it down.

If you want to help diagnose this let us know and we can remind ourselves how to dump memory statistics, ask you to do so next time, and see if anyone gets ideas for changes.
 

fronobulax

Developer
Staff member


Sticking these here since they have enough details about the two or three tools that I recall using that I can reconstruct how to use them when needed or inspired.

That said they both feel like incomplete copy/paste from a common source so the instructions may need to be augmented.
 
Top