Skip to content

Conversation

@teo-tsirpanis
Copy link
Member

SC-65510

Now that we target .NET 8, this PR makes use of some APIs added after .NET 5, and cleans up some adjacent code.

try
{
Offsets = (ulong*)Marshal.AllocHGlobal(strings.Count * sizeof(ulong));
Offsets = (ulong*)NativeMemory.Alloc((nuint)strings.Count, sizeof(ulong));
Copy link
Member Author

Choose a reason for hiding this comment

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

For historical reasons, Marshal.AllocHGlobal uses a legacy and slower API on Windows to allocate memory. NativeMemory.Alloc was introduced more recently and is documented to always call malloc while also featuring slightly improved ergonomics.

@teo-tsirpanis teo-tsirpanis requested a review from shaunrd0 May 6, 2025 14:07
@teo-tsirpanis
Copy link
Member Author

/gemini review

/// been registered with <paramref name="name"/>.</exception>
public ulong GetResultValidities(string name) => _handle.GetResultValidities(name);

private sealed class BufferHandle : IDisposable
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch!

@teo-tsirpanis teo-tsirpanis merged commit 6256ed2 into TileDB-Inc:main May 8, 2025
4 checks passed
@teo-tsirpanis teo-tsirpanis deleted the new-apis branch May 8, 2025 13:46
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.

2 participants