Replies: 3 comments 5 replies
-
GC.Collect() |
Beta Was this translation helpful? Give feedback.
-
What value would it have to hint to the GC (if you could somehow)? It will collect garbage when it thinks it needs to in order to satisfy an allocation request. |
Beta Was this translation helpful? Give feedback.
-
@danmoseley. This for sure no common scenario. I was only thinking about my current scenario where I'm working with many GB/TB of data where I'm allocating a lot in the LOH. Almost 90% of the data are in the LOH. The amount of data I need to allocate during one run is dependent on the input data which range from 5GB to 120GB). During processing multiple intermediate datasets of the same size are allocated (50-100, so for the extreme case it could happend that I allocate 120TB during one run), not all at once but during the whole processing chain. Which means the required amount of memory goes way beyond what is available in the system memory (max. 256GB but it's able to scale) so I crceated some sort of memory mapped files without using them for many reasons:
Due to this problems I need to manage things myself and created my own memory mapped files (although I find this stupid and would prefer using memory mapped files - but as shown above a few links are missing, especially the dirty bit and the information when paging is running). The reason why I'm asking if the GC can be given some additional information (in LOH only) if it would help to coordinate the cleanup for the LOH better. Still, of course the GC has to check for references to the data but if the GC would know better it could prioritize the memory that has been marked with this "special" advise method. I also thought about having some sort of ArrayPool, but I don't know the size of the data in advance and there are many different ranges of data sizes (from 32x32 to 4096x4096) and additionally the ArrayPools need to cooperate and lose memory in favor of other pools that currently need memory pressure is higher than on others. Thats why I have some sort of master control unit that coordinates the memory among the pools . Its not that I urgently need such an Advise method and of course its a very uniqe scenario, it's just a thought experiment if it could potentially improve GC performance in LOH cleanups. Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
Just an idea that came up lately. Does it make sense or is it even possible to advise the GC to cleanup object in the LOH? The idea arose from another question regarding the need for enforcing a LOH compaction.
My question is if you know that you need to cleanup an object, does it help to assist the GC to prioritize these objects?
Beta Was this translation helpful? Give feedback.
All reactions