none
.Net Framework Memory Management RRS feed

  • Question

  • We have got a big ERP application developed in .Net 4 with WPF, WCF etc,
    we did a lot of work to eliminate any memory leak from the managed heap.
    we used also a lot of tools to understand the memory allocation.

    Now the main problem is the following: the application runs for many hours
    in a day and the user loads a lot of assemblies and so the private data
    (IL code + executable code) increase and it never released.
    In general there is a costant increase of the private working set.
    After some hours the memory allocation reached 400 MB of which only
    100 MB are managed heap.

    is there any issue to avoid this costant increasing of memory ?
    is it possibile to unload assemblies ?

    Thanks
    Marco


    MarcoAB
    Thursday, June 30, 2011 7:39 AM

Answers

  •  

    Hi MarcoAB,

     

    Welcome to the MSDN forum.

     

    As I know, there is no way to unload an individual assembly without unloading all of the application domains that contain it. Use the Unload method from AppDomain to unload the application domains. For more information, see Unloading an Application Domain.

     

    You could create an appdomain when loading assembly, and then unload the appdomain when the assembly is not active and needs to release.

     

    I hope this can help you.

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Monday, July 11, 2011 2:50 AM
    Friday, July 1, 2011 5:17 AM

All replies

  •  

    Hi MarcoAB,

     

    Welcome to the MSDN forum.

     

    As I know, there is no way to unload an individual assembly without unloading all of the application domains that contain it. Use the Unload method from AppDomain to unload the application domains. For more information, see Unloading an Application Domain.

     

    You could create an appdomain when loading assembly, and then unload the appdomain when the assembly is not active and needs to release.

     

    I hope this can help you.

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Monday, July 11, 2011 2:50 AM
    Friday, July 1, 2011 5:17 AM
  •  

    Hi,

     

    Has your issue been resolved? Would you mind letting us know the result of the suggestions?

     

    Now I will mark an answer, you can mark others that you think to be so useful to your issue.

    If you still have any questions about this issue, please feel free to let me know. We will continue to work with you on this issue.

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 11, 2011 2:50 AM