-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Epic: GC Regions Support #43844
Comments
Tagging subscribers to this area: @dotnet/gc |
@mangod9 been wondering about this for a while. Any info you might share?) |
Hey @En3Tho, we are just getting started and will add more details as we make progress. If there are any specific details you are interested in please let us know. Thx! |
@mangod9 Thank you for an answer. For now, I guess it would be really cool if you could at least briefly describe what this is about (a new under-the-hood mechanism to make GC even faster or a new kinda "give me a memory region, let me so my stuff and have it back", api, sorta like arraypool/malloc, but more general version. |
it's my fault - I was supposed to write the description. I'll edit the 1st comment on the thread with the description. |
Hoh last bullet sounds particularly interesting of course others sound nice too. The only thing sour is new flavors of gc are multiyears efforts on their own i suspect never mind switch to regions itself. Maybe im too pessimistic? |
@Maoni0, do you think regions would make it easier to support custom alignments (such as 16 or 32-byte alignments) for objects/arrays? Or would that still be relegated to the POH and extending the |
@tannergooding those are orthogonal features. the reason we haven't enabled alignment is just because we haven't had time due to other more urgent work. it's something I want to enable because it's clearly useful for some (very specific) scenarios. I know you care about it a lot 😃 it's in the queue... just haven't got there yet. |
Will regions be helpful in supporting safe memory mapped files as byte arrays? |
@mjsabby what kind of issues do you hit currently doing that? are you talking about ro segments or something else? |
It’s not safe. It can be made safe if memory mapped files are backed by GC regions. There was a discussion on GitHub with @GrabYourPitchforks and @jkotas |
regions make no difference for that particular issue - I presume you are talking about #37227. I don't think GC is actually a big part in that issue - essentially from GC's POV, if it gets more ro segs it's not a big deal - we don't reclaim ro segs anyway (they can only be removed by the user code). all GC cares about is if an object points to something on the ro segs it needs to be a legit object. I saw that @jkotas already said the special treatment of Dispose was too expensive. |
Today we look at the stack for by refs, couldn't we also look at another special location for memory mapped files? I thought GC regions could accomplish that in a more natural way, maybe not, and the discussion can then stay in that thread. |
Regarding GC can a truly pauseless GC be introduced. E.g. Azul has C4: The Continuously Concurrent Compacting Collector |
i think so |
Regions are now enabled by default in main. Standalone GC has been switched to use segments to help with any backcompat issues. It can be configured using the following config (though clrgc.dll is not shipped with the sdk, and will need to be manually built if required):
|
Does enabling "GC Regions" only support for .net7 preview3? is there a way to opt in to this in .net6? |
@datduyng, you could get it to work with .net 6 but will have to build runtime repo manually and use the built clrgc.dll with |
Closing this since the regions enablement is now complete. |
@mangod9 i noticed lower memory usage but higher cpu usage with net 7 preview 6 asp net core compared with net 6 (observed with |
hi @realivanjx, is there a repro you can share? With preview6 in fact we had a working set regression as noted here: #72557 which is fixed in preview7, but we havent observed higher cpu for our asp.net based benchmarks. Thanks. |
@mangod9 not at the moment since it is the production program im using. im running it inside a docker with max memory of 300 MB so it is really a memory constrained environment (raspberry pi 4). i will try to create an empty asp net core project to see if it still happen. thanks |
Ok, could you also quantify how much increase in cpu utilization are you noticing? It could be specific to your scenario. |
yeah that memory regression should hopefully be fixed in preview7. We will have to get more info to investigate the cpu regression. |
AB#1244342
We are switching segments to regions for managing memory on the GC heap. Segments have their own benefits, eg, checking if an address is in ephemeral requires comparing with 2 values (in Workstation case) but regions enable many optimizations that we've been wanting to have for a while. For example -
Functionality
Testing
Stability
Performance
Release
The text was updated successfully, but these errors were encountered: