Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Gurus*
Posted

Glad to see you got this working in .NET. It's a good example of passing structure pointers to the Win32 API from a managed environment.

 

Just a quick comment though. You call Marshal.FreeHGlobal() in the class' Finalize method, so keep in mind how long it may take for the Garbage Collector to actually free that unmanaged memory. The only way to ensure that the memory is freed in a timely manner is to call FreeHGlobal directly after AllocHGlobal or at least make sure to call the class' Dispose method after you're finished using it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...