1

Resolved

DelegateWork generates memory leaks

description

When you use the StartBackground(Action action) or any of these methods which creates a DelegateWork, the Action set to the DelegateWork is kept in memory when returned to Pool therefore keeping any referenced instance of an object set in the delegate in memory.
 
In the DelegateWork.DoWork() method, setting its code to:
 
    public void DoWork()
    {
        Action();
        Action = null;
        instances.Return(this);
    }
 
instead of:
 
    public void DoWork()
    {
        Action();
        instances.Return(this);
    }
 
solves the bug.
 
Hope it helps ;)

comments

Aphid wrote Jun 15, 2011 at 12:51 PM

Thanks, I have committed your change to the repository.

wrote Jun 15, 2011 at 12:52 PM

wrote Jun 15, 2011 at 12:52 PM

wrote Feb 13, 2013 at 8:10 PM

wrote May 15, 2013 at 4:14 AM

wrote May 15, 2013 at 4:14 AM

wrote Jun 12, 2013 at 2:05 AM