Hi guys,
Do you have any idea as to how do we dynamically allocate memory in C#?
Please post any relevant code also.
Thanks in advance.
Saswata.
Hi guys,
Do you have any idea as to how do we dynamically allocate memory in C#?
Please post any relevant code also.
Thanks in advance.
Saswata.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Jun 19, 2007, 6:57 AM
It is possible to allocate 'unmanaged' memory yourself (for interop purposes) using methods of the System.Runtime.InteropServices.Marshal class such as AllocHGlobal():
http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.marshal.allochglobal(vs.80).aspx
In 'unsafe' code you can also allocate memory on the stack using the 'stackalloc' keyword:
http://msdn2.microsoft.com/en-us/library/cx9s2sy4(VS.80).aspx