C++ Interop Memory


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
 
Ad

Advertisements

J

Jochen Kalmbach [MVP]

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top