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# explore using readonly/span of memory for exports #1151

Open
jsturtevant opened this issue Jan 30, 2025 · 0 comments
Open

c# explore using readonly/span of memory for exports #1151

jsturtevant opened this issue Jan 30, 2025 · 0 comments

Comments

@jsturtevant
Copy link
Collaborator

          In the exports, we generate
public interface ITest {
    static abstract void EmptyListParam(byte[] a);
}

but we probably generate

public interface ITest {
    static abstract void EmptyListParam(ReadOnlySpan<byte> a)
}

because we don't expect the callee to modify that memory space.

This would allow us to pass the host buffer, instead of making a managed copy on the heap (and GC it later).

Note they could always make copy themself.

    public static void EmptyListParam(ReadOnlySpan<byte> a) {
        byte[] copy = a.ToArray();
    }

Originally posted by @pavelsavara in #1138 (comment)

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

No branches or pull requests

1 participant