[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Memory leak when writing to disk  XML
Forum Index -> Ehcache
Author Message
jckayiii

neo

Joined: 05/28/2014 06:56:05
Messages: 1
Offline

I am tracking a small memory leak in our application and all indications are that it is occurring when we reach the maximum number of elements in memory and we start writing the overflow to disk. We had a bug in our production software where the cached objects we not serializable and definitely had a memory leak. That has been fixed and it appears the leak has slowed or stopped. We are running further tests, but at this point it appears that when we keep the number of records in the cache less than the maximum number in memory we do not have a leak, but when we go beyond that we have a small leak. Are there any other reports of this and if so, has it been fixed in a later version. We are currently running EhCache core version 2.4.5.
const73

neo

Joined: 05/22/2014 08:29:27
Messages: 4
Offline

I also had a similar problem but my case was not a real memory leak.
What happened was that when elements were loaded from database many had shared attributes because of how the application was loading them, so for example the department name would be the same for lots of employees.

Later when the employees are sent to disk this is done individually and the same is true when they are loaded back from disk to memory. When this happens, the department string that was shared will be duplicated, because each one is deserialized individually.

This explains why it looked like a memory leak in my case.

To fix this I have implemented a string table with a weak reference, so when elements are loaded from the disk I check all strings to make sure they are still shared.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team