Hi,

I'm investigating memory leakage in a Ipy 2.6.1 application.

Using WinDbg I found a WeakDictionary that is only increasing in size,
though most of the instances are already collected.

This WeakDicitionary is used by a DelegationInfo object.



Looking at the code, I think I found the problem:

The method CheckCleanup is called the method "public void Add(TKey key,
TValue value)"

*But it NOT called* from the indexer:



public TValue this[TKey key] {

            get {

                return dict[key];

            }

            set {

                // If the WeakHash already holds this value as a key, it
will lead to a circular-reference and result

                // in the objects being kept alive forever. The caller needs
to ensure that this cannot happen.

                Debug.Assert(!dict.ContainsKey(value));



                dict[new WeakObject(key)] = value;

            }

        }



Since the dictionary is populated using the indexer in DelegateInfo:

_constantMap[target] = new WeakReference(clone = (object
[])_constants.Clone());



This means that the "version" field is never updated, and the dictionary
never gets cleaned up.



Have I got something wrong here?

Thanks
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to