none
GC Across App Domains RRS feed

  • Question

  • If I have more than one app domain in a single process do they get garbage collected at the same time?  I'm hoping that they are collected seperately. 
    Thursday, November 17, 2011 7:14 PM

Answers

  • It is one per CLR instance. It is not per-domain (for now, as there is only one GC thread per CLR instance), but I won't be surprised if in the future Microsoft's GC collects each appdomain on a separate CPU.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    • Marked as answer by Paul Zhou Friday, November 25, 2011 4:29 AM
    Thursday, November 17, 2011 8:14 PM
  • GC works with assembly. When an assembly is started to load, GC begins to allocate memory in GC heap for appdomains, threads, objects. It works with processes. There can be several appdomains in one process.

    You can read articles below to understand how GC works:

    How does the GC work and what are the sizes of the different generations?

    Garbage Collector Basics and Performance Hints

     

    Moreover, a good book for you: <CLR via C#>


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Paul Zhou Friday, November 25, 2011 4:29 AM
    Friday, November 18, 2011 5:30 AM

All replies

  • It is one per CLR instance. It is not per-domain (for now, as there is only one GC thread per CLR instance), but I won't be surprised if in the future Microsoft's GC collects each appdomain on a separate CPU.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    • Marked as answer by Paul Zhou Friday, November 25, 2011 4:29 AM
    Thursday, November 17, 2011 8:14 PM
  • GC works with assembly. When an assembly is started to load, GC begins to allocate memory in GC heap for appdomains, threads, objects. It works with processes. There can be several appdomains in one process.

    You can read articles below to understand how GC works:

    How does the GC work and what are the sizes of the different generations?

    Garbage Collector Basics and Performance Hints

     

    Moreover, a good book for you: <CLR via C#>


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Paul Zhou Friday, November 25, 2011 4:29 AM
    Friday, November 18, 2011 5:30 AM
  • Hi Jonathan,

     

    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.

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Friday, November 25, 2011 4:29 AM