If I remove all the configuration sources by adding the following before. Asp.Net Core API controller memory leak Issue 45098 dotnet/aspnetcore GitHub 1 task done on yarong-lifemap commented on I have searched the existing issues. I think I've confirmed it's a memory leak. It probably wont effect me because I don't expect thousands of restarts, but is it worth creating an issue on the github if this is actually a leak? Am I diagnosing this as a memory leak when it isn't? My question is whether this is an issue or not. This is with the GC.Collect and GC.WaitForPendingFinalizers being called at the end of each loop. The application starts at ~10-20mb of memory being used, but after 17000 loops it had gotten up to 200mb+. I added WriteLine to track the number of loops that have occured and ran it for a couple minutes. I'm guessing it might be for one of the configuration files? So to me, it seems like there is a file watcher being created at some point in the IHost that isn't properly being disposed. The highlighted items count seems to marry up with the number of looks that have occured. Net Core client applications failing with memory issues due to FileSystemWatcher API then set the environment variable CTGRELOADONCHANGEfalse and re-run the. You can see there are a few things that are consistently building up. Var host = Host.CreateDefaultBuilder().Build() Īnd here is the memory snapshot. Private static async Task Main(string args) I can see the GC is being run, so I don't think that it would ever get cleaned up. If it is, then get on with the intended file operation. In the callback, check the file is available for write operations. Setup a callback, which will execute when the event expires from Memory Cache. Below is a simple console app to show pretty much what I'm doing, and you can see it just slowly but consistently gains memory usage. When a file system event occurs, store its details in Memory Cache for X amount of time. I ended up finding that just starting/stopping a default IHost seemed to cause a similar issue (Though to a lesser degree). That's not terrible, but it made me think I wasn't disposing of something correctly. It seemed like I was gaining 10-50mb for every ~1000 restarts. I found that there was a small memory leak somewhere. Stopping/Starting involves stopping the IHost and disposing of it, then starting a new one. I started doing stress tests on it to see if there was any memory leaks when stopping/starting the 'plugins'. We then notice that, eventually, the report will release all the memory after 10 to 20 minutes. NET Remoting to dynamically create a sub appdomain and run the report in order to avoid a leak internally somewhere. The root app will run as a windows service, and will create an IHost for each 'plugin' so that each one can have its own DI container. I have a real solution and can explain why It turns out that LocalReport here is using. Thanks for helping make community forums a great place.I'm currently working on a plugin-like system that requires loading in assemblies at runtime. We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. inside the JVM long after the job has ended, causing memory leaks. You can try adding some calls to GC.Collect temporarily to see if that has an effect on memory usage.Īs far as i know, change statics to instances the memory consumption decreased noticeably and GC also was able to free much more memory. Don't rely on static helper classes.īy the way, i have found the way to fix Memory leak when you use the FileSystemWatcherįIX: Memory leak when you use the FileSystemWatcher class in a. File watcher is a streaming file source, where only the new files or appended lines.
0 Comments
Leave a Reply. |