Sign in to follow this  

[MDX] Vertex and C# allocation

This topic is 4249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Thanks for the reply.

Regarding the struct, here is a great article that will explain it very well.
http://www.albahari.com/value%20vs%20reference%20types.html

Share this post


Link to post
Share on other sites

This topic is 4249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this