-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
[Discussion] Should we free TEXT
?
#178
Comments
Yes, you absolutely should. Sorry -- some of my samples are very shoddy in this regard, since they're short lived and the process will free up the memory on exit. I've gradually moved some of them over to use a |
I've made a number of fixes to this in the short term. As you say, it's important to do this in production code, but it makes some of the samples rather painful to read because of all the allocation / deallocation. Ultimately I'd like to fix this by using the |
BTW, should we free if (FAILED(hr)) {
// ...
free(pLoc.ptr);
CoUninitialize();
throw exception;
} |
I think I've fixed all instances of this; please reopen if you find any further leaks. |
https://github.com/timsneath/win32/blob/cc4870102e95b0c2cf0f4ca31e15baa1f783fe9e/lib/src/utils.dart#L22
TEXT
usestoNativeUtf16
, which usesallocator
https://github.com/dart-lang/ffi/blob/24eb0a066d3b32e54682a57e4780af4e2efbd2d3/lib/src/utf16.dart#L76-L83
But code in samples doesn't take care of
free
https://github.com/timsneath/win32/blob/cc4870102e95b0c2cf0f4ca31e15baa1f783fe9e/example/hello.dart#L41
Related: dart-archive/ffi#86
The text was updated successfully, but these errors were encountered: