[MDX] Vertex and C# allocation
Ok, I am being a bit paranoid here. I am creating an array of CustomVertex.TransformedColoredTextured. But, I need to drop the array and re-create a new one of different size... so:
call 1:
myvert = new Microsoft.DirectX.Direct3D.CustomVertex.TransformedColoredTextured[10];
call 2:
myvert = new Microsoft.DirectX.Direct3D.CustomVertex.TransformedColoredTextured[22];
There is no "Dispose" function inside the CustomVertex. So does the memory from the first step that allocated 10 objects get released? I am hoping it does, but I am unsure how it plays out with MDX.
Thank you.
As you create a normal managed array and not a MDX vertex buffer there is no need to dispose it. The garbage collector will detected that there is no reference left and will free the memory for future use.
A quick semi-related question here... So arrays will be handled by the GC as I thought, but what about a single struct? I was under the impression that these get handled by 'deterministic finalization', ie. once the app leaves execution block in which they were created, they automagically are freed (provided they're not referenced elsewhere). Would that be correct, or are structs also just freed by the GC?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement