CollaboratingPlatypus / PetaPoco

Official PetaPoco, A tiny ORM-ish thing for your POCO's
Other
2.07k stars 600 forks source link

Memory leak for mysql #721

Open thenik opened 3 months ago

thenik commented 3 months ago

Hi,

Memory leak detected for mysql data via PetaPoco during intensive usage :

image

Any ideas how to adjust it?

asherber commented 3 months ago

@thenik It's not clear to me what that image is showing. Can you please describe what you think is being leaked, and provide a minimal repro?

thenik commented 3 months ago

@asherber . Thanks for your question.

This images shows 1 of many reteined objects for my app during 1h of usage. For this image it is RuntimeMethodHandle . About 26K RuntimeMethodHandle objects retained for my app during 1h . image

I used dotMemory for analysis and as you see this RuntimeMethodHandle object came from PocoData. I do not have an independent code sample that will reproduce that now.

asherber commented 3 months ago

If I had to guess, I'd say that this is something being kept in PocoData's cache rather than something being leaked. Are you running queries with thousands of different types?

Without some sort of minimal repro, this will be hard to diagnose.

thenik commented 3 months ago

@asherber Yes, you are right that I found something interesting with PocoData's cache. I call it memory leak =) I call it memory leak because when I look at my app via TaskManager it could consume up to 2gb RAM if it works more than 1 month and it came from PocoData's cache as I know now.

Are you running queries with thousands of different types?

no =) I use for this case just 6 types, I marked them on the next image:

image

to be honest I tried to create a demo c# app that will reproduce that, but still without success 1st version was 1 thread version with 1 type 2nd - multithread with 1 type 3d - multithread with 2 types

and there is no my "memory leak" I do not have idea how to implement an app that will reproduce that now.

if any ideas what I can implement for demo app to reproduce or where to look - welcome. Thanks