Memory Leak - HostedApplications not properly disposed

Jan 30, 2014 at 8:25 AM
Edited Jan 30, 2014 at 2:28 PM
Hi all,

we have a memory problem with our cca solution. when a session starts we create a dynamic application, which is a custom (WPF) Hosted Application. Prior to the Session Close we unwire all Events this HostedApplication has to external Classes. After the Session Close, we close the dynamic application.

The memory consumption of the AgentDesktop App rises proportional to the number of sessions opened during the AgentDesktops lifecycle. Which results in up to 1GB memory consumption.

Anylizing this behaviour with a memory profiler pointed out, that the instances of our Hosted Application can not be disposed by the GC due to an reference to the class Microsoft.Uii.Csr.ContextState this class leads to the Microsoft.Uii.Csr.ApplicationHost

Can anybody share some experience on this topic? Is there anything we need to do when closing a Dynamics Application to ensure that it is properly deleted from the heap?

thanks in advance

Feb 5, 2014 at 7:54 AM
ok, we've wrongly created a new Context object (and fired the context change event..) in our HostedControl instead of using the one created by the ContextManager. therefore the HostedControld couldn't be disposed.

Anyway, it is noticeable that WebHostedApplications arent disposed and as there is no object we explicitly create for that kind of Application we dont know how to get rid of them when they are closed (by user, the end of the session or some kind of workflow)

Does anybody have some information about this?

thanks in advance

Sep 8, 2015 at 10:42 AM
Hi ndi,

Did you figure out why you WebHostedApplications were not being disposed?

Sep 8, 2015 at 10:47 AM
hi matsy,

it was due to some custom event handlers that were not properly unsuscribed. pretty dull.

we used redgates memory profiler to figure that out.

best regards

Sep 8, 2015 at 10:51 AM
Thank you for the fast reply!

I will check it out!