Hi KakCATCAT,
This question is more related to C# garbage collection. Since Microsoft Q&A forum doesn't support C# currently, we suggest you could move to C# msdn forum, and then post a new thread there, the community members will provide dedicated support for you.
By the way, you could read this reply from stack overflow, maybe it could answer your question.
Best Regards,
Dylan