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
NLog devours memory and doesn't release it back #2343
Comments
Well You could also try to write faster, e.g. 2 GB sounds indeed too much, but it really depends on how many logs you're writing. |
Just to keep things clear. As far as I understand, But when particular item is sent to underlying target ( I mean, there's no reason to keep written item in memory any more.
Thanks, I'll try to set these values. Synchronous logging isn't a good choice for me - this application is a backend service, and it write logs intensively. |
yes indeed! |
OK. So, the only reason I see at the moment is that log items are being produced faster, than background thread writes them to file. I really should try to re-configure async wrapper. Thanks. I'll close the issue. |
OK thanks for the feedback! |
@Dennis-Petrov You are waiting for this commit, that fixes the default behavior of the async-wrapper. #1757 Right now you have to configure the Async-wrapper manually. But you should also check the configuration of the file-target. NLog uses the most compatible file-access by default, but keepFileOpen="false" only allows for 1500 writes/sec, but the asyncwrapper helps batching multiple logevents into a single write. If you don't have multiple processes writing to the same file, then you should configure these settings for the file-target:
If you need multiple AppDomains/Processes writing to the same file (and it is not on a network-drive), then you should use this file-target configuration (enables atomic file access between processes on the same machine)
If you must use the most compatible file-access, then you should add this to your file-target configuration (This is no longer needed after #3444 in NLog 4.6.5, as it chooses optimal size)
See also https://github.com/nlog/NLog/wiki/File-target#performance-tuning-options |
@snakefoot, thanks a lot! |
Hi.
Bug
For testing purposes my application is running as a console application.
I've faced with high memory consumption on a testing machine (about 3 GB memory per process). Here's process dump analysis results from VS 2017 (top of roots):
As you can see, first 7 items are NLog ones with about 2 GB of memory.
Logging is used very intensive, and I don't want to loose log items, that's why
overflowAction="Grow"
is set below.What am I doing wrong? Is this actually a bug? Is configuration below valid?
NLog version: 4.4.12
Platform: .Net 4.6.2
Current NLog config:
The text was updated successfully, but these errors were encountered: