mbdavid / LiteDB

LiteDB - A .NET NoSQL Document Store in a single data file
http://www.litedb.org
MIT License
8.36k stars 1.22k forks source link

[BUG] Memory Leak #2421

Open kimdiego2098 opened 4 months ago

kimdiego2098 commented 4 months ago

Version 5.0.1.7

Describe the bug

When using Query.LT or other code for BsonExpressionScalarDelegate , looking up the source code may reveal that there is a dictionary storing expressions, but this dictionary cache is the root cause of memory leakage. I think it should be changed to memorycache (i.e. adding timeout clearing). As can be seen from the graph, the number of dictionary elements has reached over 4000

I had to change the Queries to use Lambda expressions.But this is inconvenient, and there may still be different keys in the dictionary, leading to memory leaks

A_{KP1B6LJ3I)V015VER755

Code to Reproduce

image

Expected behavior A clear and concise description of what you expected to happen.

Screenshots/Stacktrace If applicable, add screenshots/stacktrace

Additional context Add any other context about the problem here.

kimdiego2098 commented 4 months ago

@mbdavid Sorry to bother you, but this is a serious memory leak issue

JKamsker commented 3 weeks ago

I will be looking into it