GameObjectContext pool memory leak fix. Todo: cover by test#214
Draft
kkohno wants to merge 3 commits intomodesttree:masterfrom
Draft
GameObjectContext pool memory leak fix. Todo: cover by test#214kkohno wants to merge 3 commits intomodesttree:masterfrom
kkohno wants to merge 3 commits intomodesttree:masterfrom
Conversation
Author
|
Seems that StaticMemoryPoolRegistry is cause of leaks. It is only Editor feature. But in some cases it is big trouble. For example - the scanning anti-cheat system for editor... |
Author
|
Maybe WeakReference is key to solve this: StaticMemoryPoolRegistry.cs:namespace Zenject
{
#if UNITY_EDITOR
public static class StaticMemoryPoolRegistry
{
public static event Action<IMemoryPool> PoolAdded = delegate {};
public static event Action<IMemoryPool> PoolRemoved = delegate {};
readonly static List<WeakReference> _pools = new List<WeakReference>();
public static IEnumerable<WeakReference> Pools
{
get { return _pools; }
}
public static void Add(IMemoryPool memoryPool)
{
_pools.Add(new WeakReference(memoryPool));
PoolAdded(memoryPool);
}
public static void Remove(IMemoryPool memoryPool)
{
_pools.RemoveWithConfirm(new WeakReference(memoryPool));
PoolRemoved(memoryPool);
}
}
#endif
} |
Author
|
yes, my code is working... but i changed MpmView.cs too, for output correct pools and exclude memory leaks. I can make pool request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for sending a pull request! Please make sure you read the contribution guidelines
Pull request checklist
Please check if your PR fulfills the following requirements:
Pull request type
Please check the type of change your PR introduces:
Issue Number: #118
What is the new behavior?
only failing test
Does this introduce a breaking change?
Other information
On real case it work fine, when my system frequently reloads the scenes, but test are fails. I not sure, that this test available at all, because .Net Garbage Collector has no exact dispose method call time (correct me, if i am not right)...
On which Unity version has this been tested?
Scripting backend: