C++ Interop Memory

  • Thread starter Thread starter Urs Vogel
  • Start date Start date
U

Urs Vogel

Hi

1. Is Marshal::AllocHGlobal(IntPtr) always pinned memory?
2. Is Marshal::AllocHGlobal(int) moveable or pinned memory?

MSDN doesn't really explain that little difference ...

Thanks, Urs
 
Hi Urs!
1. Is Marshal::AllocHGlobal(IntPtr) always pinned memory?
2. Is Marshal::AllocHGlobal(int) moveable or pinned memory?

Neither has something to do with garbage-collection and therefor
"pinned" makes no sence...

The returned IntPtr always points to a unmanaged memory region!

See: Marshal.AllocHGlobal
http://msdn.microsoft.com/library/e...ropservicesmarshalclassallochglobaltopic1.asp

and

See: GlobalAlloc
http://msdn.microsoft.com/library/en-us/memory/base/globalalloc.asp

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Back
Top