© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2mo ago•
3 replies
KaenguruuDev

How to find cause of memory leak in containerized application

beginner
I am running a Discord bot through a Pterodactyl Panel which runs "servers" as docker containers in the background. I noticed that after roughly 1.5 days, the program seems to reach 1000MiB of memory usage, even though it always starts out at ~250MiB. I found a lot about "this could just be the gc doing it's thing", however I feel like there has to be a little more than just that. Especially because I already tried
DOTNET_GCHeapHardLimitPercent=80
DOTNET_GCHeapHardLimitPercent=80
which should limit the application to 800MiB max. It is still exceeding this limit. I am also struggling with the fact that the image I am using to run the dotnet application seemingly doesn't like me installing additional profiling tools like dotnet-counters etc. I am getting various errors during installation that I haven't found a way around. Because this leak isn't very fast (750MiB over 36 hours = 20MiB per hour), I've had trouble diagnosing it while running the application locally. If you have any tips or tricks how I could start to find the issue, I'd love to hear them.

Thank you in advance!

Attatched is a chart from entries in my database. X axis is time (~36 hours, Y axis is bytes.
Red: MemoryLoadBytes
Orange1: TotalCommittedBytes
Orange2: HeapSizeBytes
Yellow: FragmentedBytes)
chart.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Memory Leak Issue in .NET/C# Application
C#CC# / help
4mo ago
❔ Memory leak in a .NET 7 Webapi application
C#CC# / help
3y ago
❔ I somehow cause memory leak with Process.Start()
C#CC# / help
3y ago
Memory leak : WeakReferences
C#CC# / help
17mo ago