Skip to content
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 Leak in XmlSerializer #2

Open
JakobChristensen opened this issue Aug 10, 2023 · 1 comment
Open

Memory Leak in XmlSerializer #2

JakobChristensen opened this issue Aug 10, 2023 · 1 comment

Comments

@JakobChristensen
Copy link

Hey Morten

FYI:
I am using your code on my Synology NAS with .NET6 and I noticed a memory leak (the NAS only has 2GB RAM).

After some digging I found this article: https://www-jo.se/f.pfleger/memoryleak/#:~:text=If%20you%20use%20any%20of,the%20previously%20mentioned%20two%20constructors.

which describes a memory leak in XmlSerializer if you use the wrong constructor (which is incredibly stupid in my opinion). Microsoft even has a fix in their documentation: https://learn.microsoft.com/en-us/dotnet/api/system.xml.serialization.xmlserializer?view=net-7.0&redirectedfrom=MSDN#dynamically-generated-assemblies

I implemented the fix in my fork (in the serialize.cs file) and it fixed the issue.

Just thought you should know, if you have any issues with memory leaks.

And sorry for not making a pull request.

Best
--Jakob

@mmc41
Copy link
Owner

mmc41 commented Aug 11, 2023

Thanks for reporting this. Since you have the right code - Can you post your changes here as a reply (or make a PR) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants