Print Page | Close Window

Clearing Entity/Query Cache (memory leak)

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2686
Printed Date: 04-May-2024 at 1:02am


Topic: Clearing Entity/Query Cache (memory leak)
Posted By: tooms
Subject: Clearing Entity/Query Cache (memory leak)
Date Posted: 17-May-2011 at 3:21pm
I'm investigating memory leaks within our application and set up a small test app to narrow them down.
 
When I grab data using the PeristenceManager I can see the increase in memory use equivelant to the amount of data retrived. However when I clear those entities from the cache, the memory does not decrease. If the entities are grabbed again, the memory is increased by the same amount. If I continue this loop I can blowout memory use to the point where the application fails.
 
I have two questions.
 
I clear the cache using QueryCache.Clear() and DataSet.Clear()  ... Is this the correct way to do so?
 
and if this is the correct way, then it appears there is a memory leak within Ideablade. If a query increased memory use by 50mb (example only) and I then clear that cache, that 50mb is not released. Grabbing that data again increases memory use by another 50mb (100mb in total).
 
Cheers,
Paul Twomey
MEX



Replies:
Posted By: robertg
Date Posted: 18-May-2011 at 12:03pm
Paul,
 
Do you still see this symptom if you use RemoveEntities instead? Also, what version of DevForce 2009 are you using, and is there any chance you could upload your test solution for me to take a look at? I'll certainly test this to see if there's a problem, but it might just be that the cleanup hasn't occurred yet. I don't know when garbage collection occurs for Clear and will ask.
 
-- Robert


Posted By: tooms
Date Posted: 18-May-2011 at 3:26pm
Using version 3.7.1.0
 
Ah indeed RemoveEntities does indeed work, that's good news.
 
I also started cleaing my grid controls data/binding source and that seems to make the .Clear() calls work, but they take longer to cleanup than RemoveEntities.
 
I'm not yet convinced, I still have definite memory leaks ... But there may be other culprits.
 
Cheers,
Paul Twomey
MEX


Posted By: robertg
Date Posted: 18-May-2011 at 3:36pm

Good to know, Paul. Let me know if you run into any other oddities, and we'll see what we can find.




Print Page | Close Window