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

csharp: native memory leaks in CAdbcDriverImporter.cs #1690

Closed
nazar554 opened this issue Mar 30, 2024 · 0 comments · Fixed by #1695
Closed

csharp: native memory leaks in CAdbcDriverImporter.cs #1690

nazar554 opened this issue Mar 30, 2024 · 0 comments · Fixed by #1695
Assignees
Labels
Type: bug Something isn't working

Comments

@nazar554
Copy link

nazar554 commented Mar 30, 2024

What happened?

Code allocates temporary arrays and doesn't call Marshal.FreeHGlobal.
Can be also solved by using CollectionsMarshal.AsSpan and fixed on newer .NET versions.

IntPtr bytePtr = Marshal.AllocHGlobal(totalBytes);

byte** bTable_type = (byte**)Marshal.AllocHGlobal(IntPtr.Size * table_types.Count);

There are similar calls to Marshal.StringToCoTaskMemUTF8 that are also not freed.

How can we reproduce the bug?

No response

Environment/Setup

No response

@nazar554 nazar554 added the Type: bug Something isn't working label Mar 30, 2024
@nazar554 nazar554 changed the title Native memory leaks in CAdbcDriverImporter.cs csharp: native memory leaks in CAdbcDriverImporter.cs Mar 30, 2024
@CurtHagenlocher CurtHagenlocher self-assigned this Apr 1, 2024
@github-actions github-actions bot added this to the ADBC Libraries 1.0.0 milestone Apr 1, 2024
CurtHagenlocher added a commit that referenced this issue Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants