Re: Watch out for memory leaks with EhCache
Andrus Adamchik <[email protected]>
| Newsgroups | gmane.comp.java.cayenne.devel |
|---|---|
| Message-ID | <[email protected]> |
> On Dec 10, 2019, at 9:39 PM, John Huss <[email protected]> wrote: > >> My projects are set up to use soft references using " >> cayenne.server.object_retain_strategy=soft". I wouldn't expect this to >> behave differently than weak under memory pressure, but my unit test with >> soft is not releasing this memory. I'll try running the test with "weak" >> and see if that changes it. And I'll look at your project (thanks for >> that). >> > > To clarify for future readers, we're talking about objects being retained > by this reference path: > QueryCache -> cached_object -> ObjectContext -> > other_objects_that_weren't_cached > > Sorry, I was wrong about the cause here. The persistent objects ARE > released by the context's objectStore (whether using weak or soft). But the > context is still retaining a lot of extra memory. I'm having a hard time > determining the specific cause. It might be the dataRowCache? If you have "Use Shared Cache" unchecked in the modeler, then you get a single dataRowCache per context, so that would definitely explain it. I am using the default - one dataRowCache per stack, shared by all contexts, so that's never a problem. Andrus