Page 1 of 1

Castle Windsor Interceptor Usage

Posted: Tue Dec 28, 2021 10:48 pm
by GaxUser
I seem to be experiencing a memory leak when using castle interceptors. I create components via a factory and if I dispose those components they do not get GCed. I'm not sure what I could be doing wrong, or what I need to do to alleviate the problem. Is there a way to unhook the interceptor or I'm I misunderstanding the real problem?
Untitled1.png

Re: Castle Windsor Interceptor Usage

Posted: Wed Dec 29, 2021 8:00 pm
by Andreas Suurkuusk
I'm not sure how interceptors in Castle Windsor are implemented, and it's hard to tell from the screenshot which types belong to Windsor and which are your own types.

The screenshot does show that the disposed LabelViewModelProxy is kept alive as a key in the "instance2Burden" dictionary. Since this is a strong reference, the LabelViewModelProxy instance must be removed from the dictionary somehow, to allow it to be garbage collected. If you have control over the instance2Burden dictionary, I recommend that you try to remove the LabelViewModelProxy instance when it is disposed.

To give you better help with identifying the memory leak, it would be good if you could send us a session file. You can contact us at support@scitech.se for information on how to send a session file to us.