当前位置: 动力学知识库 > 问答 > 编程问答 >

memory management - C# Marshal class available on Xbox?

问题描述:

does anyone know if the Marshal class is available on the xbox360, specifically the AllocHGlobal method.

Unfortunately I don't have access to an xbox right now, otherwise I would test it myself!

Basically I want to be able to allocate unmanaged memory myself, ie. this piece of code should work:

IntPtr ptr = Marshal.AllocHGlobal(10000);

void* v = (void*)ptr.ToPointer();

byte* b = (byte*)v;

b[0] = 1;

b[2] = 3;

Marshal.FreeHGlobal(ptr);

If anyone is in a kind mood and has access to an xbox and an XNA creators club subscription, you can stick that piece of code into the update method of your game and see if it works.

网友答案:

No, you can't.

分享给朋友:
您可能感兴趣的文章:
随机阅读: