a new GC API for large array allocation
To give users with high perf scenarios more flexibility for array allocations I propose to add a new API in the GC class. ## Rationale Below are mechanisms we would like to support for high perf scenarios - [coreclr dotnet/runtime#20704](https://github.com/dotnet/coreclr/issues/17325); - choose whether you want to allocate the object as a gen0 object or in the old generation; - choose whether you want to pin the object you are requesting to allocate; I am also thinking of exposing the large object size threshold as a config to users and this API along with that config should help a lot with solving the LOH perf issues folks have been seen. ## Proposed APIs ```csharp class GC { // generation: -1 means to let GC decide (equivalent to regular new T[]) // 0 means to allocate in gen0 // GC.MaxGeneration means to allocate in the oldest generation // // pinned: true means you want to pin this object that you are allocating // otherwise it's not pinned. // // alignment: only supported if pinned is true. // -1 means you don't care which means it'll use the default alignment. // otherwise specify a power of 2 value that's >= pointer size // the beginning of the payload of the object (&array[0]) will be aligned with this alignment. static T[] AllocateArray<T>(int length, int generation=-1, bool pinned=false, int alignment=-1) { // calls the new AllocateNewArray fcall. return AllocateNewArray(typeof(T).TypeHandle.V
Posted by Maoni0 on Aug 15, 2018, 9:24 PM
Tags
Related issues
- Add 65536 size support for maps
- TypeScript 7.1 Iteration Plan
- nvim-treeconfig: upstream nvim-treesitter
- Add the "action" and "method" attributes to <button>
- [FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
- > We were imposed GitHub for so many exercises!
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
support (Software)
Add 65536 size support for maps
TypeScript 7.1 Iteration Plan
nvim-treeconfig: upstream nvim-treesitter
Add the "action" and "method" attributes to <button>
[FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
> We were imposed GitHub for so many exercises!
Add support for Visual Studio 2026 Integration
Support for Helm v4
a new GC API for large array allocation
To give users with high perf scenarios more flexibility for array allocations I propose to add a new API in the GC class. ## Rationale Below are mechanisms we would like to support for high perf scenarios - [coreclr dotnet/runtime#20704](https://github.com/dotnet/coreclr/issues/17325); - choose whether you want to allocate the object as a gen0 object or in the old generation; - choose whether you want to pin the object you are requesting to allocate; I am also thinking of exposing the large object size threshold as a config to users and this API along with that config should help a lot with solving the LOH perf issues folks have been seen. ## Proposed APIs ```csharp class GC { // generation: -1 means to let GC decide (equivalent to regular new T[]) // 0 means to allocate in gen0 // GC.MaxGeneration means to allocate in the oldest generation // // pinned: true means you want to pin this object that you are allocating // otherwise it's not pinned. // // alignment: only supported if pinned is true. // -1 means you don't care which means it'll use the default alignment. // otherwise specify a power of 2 value that's >= pointer size // the beginning of the payload of the object (&array[0]) will be aligned with this alignment. static T[] AllocateArray<T>(int length, int generation=-1, bool pinned=false, int alignment=-1) { // calls the new AllocateNewArray fcall. return AllocateNewArray(typeof(T).TypeHandle.V
Comments (0)
No comments yet. Start the discussion.