-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory growth on Linux with "journal_mode=memory" #34695
Comments
@IkerPSR do you ever see an actual OutOfMemoryException? If not, this is probably just the normal behavior in a garbage collection language - the GC only kicks in and reclaims memory when it needs to, or based on various parameters. You may want to look into switching from GC server to workstation mode. |
@roji In linux, the memory grows and grows until it takes up all the system memory and the SO kills the process, but no OOM exception occurs, which indicates a serious problem (only in Linux) The expected behavior would be for the garbage collector to act at some point, but it doesn't. Also, in the attached example, I call but that is not successful either. Could you try the attached example code on Linux/Windows and give me your impressions? Thanks in advance |
@IkerPSR OK, thanks for confirming. It's quiter unlikely that Microsoft.Data.Sqlite itself could produce a memory leak that's only on Linux - this could be something lower-level... @cincuranet interested in taking a look? |
@roji I'll have a 👀. |
Hello, I have been investigating with dotnet debugging tools and I see something very strange with the memory after executing DELETE several times |
Hello again, Could the problem be related to glibc-malloc?
After setting the following values I have invented the values and I don't know what they really mean. |
This looks more like an unmanaged/native memory. Anyway. I would first, instead of |
@cincuranet Here it is the captured eeheap, and the real working set is about 350MB... I've tested on latest version of Microsoft.Data.Sqlite v9.0.0-rc.1.24451.1 (sqlite version 3.45.1) and the problem persists in this version |
This gives me the confidence that this is not in managed world, but rather native memory. You can try, again "just in case", run on .NET 9 runtime. Either way, there's not much we can do here in terms of |
Hello,
I need help with a memory growth problem in Microsoft.Data.Sqlite 8.0.8 on Linux (reproduced on linux-x64 and linux-arm64), and it doesn't happen on Windows.
Tested on a C# .NET8 project, the memory growth occurs when "PRAGMA journal_mode=memory" is used: in this mode, when executing commands (ExecuteNonQuery) that affect thousands of lines of a table (for example a DELETE), it is observed that the memory of the thread from which the command was executed, grows and is not released at the end of the command execution. Memory is permanently reserved for each thread that executes the command, so the total memory used by the process grows for each new thread launched.
This only happens on Linux. I have tested the same code on Windows and the memory is freed correctly after each command is executed.
I attach a sample project reproducing the problem:
Sqlite_journal_mem.zip
On Windows, the memory is released after command execution
On Linux the memory grows for each thread
Am I missing something?
Microsoft.Data.Sqlite version: 8.0.0
Target framework: .NET 8
Operating system: Reproduced on
Thanks in advance
The text was updated successfully, but these errors were encountered: