Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

HalfLucifer

Memory leak in GameTut#4? (and a correctness about md2 animation)

This topic is 6300 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

I saw what the Nehe news said that there was a memory leak in GameTut#4 and had been eliminated; I''d like take a look at it, but I cannot find in tut or code where the original memory leak is. Anyone knows that? I found a tiny problem about the MD2 animation in GameTut#4. There would be an abnormal "flip" while the model''s repeating "IDLE"(default animation). In MD2::Animate(), if replacing "if(currentFrame==-1 || currentFrame>endFrame)" with "if(currentFrame==-1 || nextFrame>endFrame)", I think it would get rid of the "flip" problem.

Share this post


Link to post
Share on other sites
Advertisement
I forget the exact variable names but this is the general idea:

There was an allocation of memory in MD2::Load() I believe

  
somePtr = new someType[someSize];


And it was being deleted in MD2::~MD2()

  
delete somePtr;


However, whenever you allocate an array of memory, you need to delete the whole array.

  
delete [] somePtr;


I hope you get the general idea.

Edited by - Parveen Kaler on July 17, 2001 5:44:52 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!