Skip to content
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

c#: Use stack when the list is smaller than a given value #1144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsturtevant
Copy link
Collaborator

fixes #1012

@jsturtevant
Copy link
Collaborator Author

/cc @AaronRobinsonMSFT @pavelsavara

{{
var {buffer_size} = {size} * (nuint){list}.Count;
{address} = NativeMemory.AlignedAlloc({buffer_size}, {align});
cleanups.Add(()=> NativeMemory.AlignedFree({address}));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wishful thinking - not blocked for this PR:

It would be awesome if we could see this in context of some generated sample.
Maybe we can have wit->C# integration test in which the C# file is committed into git ?
That would show up as delta in the generated code in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C#: use stackalloc where appropriate for caller-allocated buffers
2 participants