none
ICLRGCManager->SetStartupLimits() size ignored for Generation 0 after garbage collection RRS feed

  • Question

  • Greetings, 

    Environment: CLR v4, x86

     In a host application I am setting the segment and generation 0 size through the ICLRGCManager->SetStartupLimits() function. The actual function call goes well and subsequently I can observe that things are, initially, working as expected. However it seems that after two generation 0 garbage collections, the size of generation 0 somehow defaults back to 6 MB - no matter the inital size (less or above 6 MB) and no matter the segment size (which also seems to default back to around 8MB - though that value I am not completely certain about). 

     The data I view is from the ICLRGCManager->GetStats() and it is in agreement with data from the .NET memory performance counters. 

    Are there some undocumented features which must be observed while using the SetStartLimits() function or is there a bug somewhere?

    Thanks!

    Thursday, July 7, 2011 12:15 AM

Answers

  • There is very limited documentation ICLRGCManager interface and if we need drill further we need have a sample and analyze it using performance counters. From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.
    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Wednesday, July 20, 2011 1:21 PM
    Moderator

All replies

  • Hi,
    We're investigating on this issue, it might takes some time before get back to you, thank you for your understanding.
    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.

    Thursday, July 7, 2011 6:49 AM
  • Hi Paul, 

     Thank you for your reply. Would it be faster if I go through connect instead?

    Thursday, July 7, 2011 10:02 AM
  • GC is really smart and it self-tunes itself to the application's needs. It is not a good idea to make changes to the GC parameters. Can I know what exactly are you trying to accomplish? What exactly are you doing in your main application which needs to change the segment and generation 0 size using  the ICLRGCManager->SetStartupLimits() function.


    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Wednesday, July 13, 2011 9:04 PM
    Moderator
  • Hello Trevor, 

     

    Thank you for your reply.

    I am merely exploring the hosting API and as such not really doing anything extraordinary, yet. However I do envision a near future where I want to control generation 0 and 1 in order to, as much as possible, avoid generation 2 collections - i.e. a near real-time system where a full GC will ruin the SLA. The SetStartupLimits() looked promising, but alas, only for a short time.

    Is there some documentation on the 'smartness' of the GC in this aspect? 

    Wednesday, July 13, 2011 9:55 PM
  • Hi,

    The MSDN link for the ICLRGCManager -> SetGCStartupLimits says  - “The values that SetGCStartupLimits sets can be specified only once. Later calls to SetGCStartupLimits are ignored

    You can find more info on :-

    http://msdn.microsoft.com/en-us/library/ms164374.aspx

     

     

    I hope the following link should help you.

    http://social.msdn.microsoft.com/Forums/en-AU/netfxbcl/thread/dcd4e45e-d5a4-4493-a53e-4c3c0781a6ad

     

    Is there any sample code you like to share to simulate the behavior?


    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Monday, July 18, 2011 5:52 PM
    Moderator
  • Hello Trevor, 

     Thanks for your reply. 

     I am only calling the SetGCStartupLimit once - after the host is initialized, but before I execute any code in it. 

     I understand that the GC tunes itself and that is all well and good. But then I fail to see how SetStartupLimits is of any practical use. In my scenario I must support many short-lived objects which will fill up Gen 0 and Gen 1 quite fast (with the default sizes). But since these are very short lived I do not want them to be carried over to Gen 2, as a complete Generation 2 GC might break the SLA due to the GC locks of the servicing threads  - gen 0 and gen 1 GCs are expected to be short lived and within the acceptable time limit. 

     The idea was then to make Gen 0 and 1 larger and thus be more in control of when a full GC would occur and be able to adjust the system accordingly - maybe even force full GCs during 'safe' service intervals - with the default GC sizes this is not possible at all. 

    There is no code as this is all still on the architectural level, but the idea was to avoid creating a manual 'memory' management solution and play with the GC parameters instead. 

    Monday, July 18, 2011 6:12 PM
  • There is very limited documentation ICLRGCManager interface and if we need drill further we need have a sample and analyze it using performance counters. From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.
    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Wednesday, July 20, 2011 1:21 PM
    Moderator