Skip to content

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

@jsturtevant

Description

@jsturtevant
          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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions