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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AlanRank #669 · 3.6K reputationPosted Jun 19, 2007, 2:57 AM EDT
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