.NET generation 0 heap size

后端 未结 7 1929
礼貌的吻别
礼貌的吻别 2021-01-01 21:21

Is it possible to set a minimal size of a generation 0 heap in .NET?

I have a folowing sistuation. I have a function that allocates around 20-30 MB of 1KB objects, d

7条回答
  •  盖世英雄少女心
    2021-01-01 21:34

    I don't think there's any option to set these values in .NET GC.

    At first glance, looks like this particular situation justifies the need to have such advanced options, but if this would be a static option that it will affect all the lifetime of you program. A dynamic option, that you could set at runtime would be ideal.

    Also, I don't think this will hugely affect the performance of your program, although if you where able to increase the gen(0) size you could free some memory (and gain some performance).

    Because the GC is self-tunning, gen(0) will automatically increase size and the BIG objects will end up being garbage collected, sooner or later.

提交回复
热议问题