memory leaks .. ?

Started by
13 comments, last by Xces 21 years, 10 months ago
Thanx. About debugging.... Everytime I try to run the debugger I get errors in the memory heap source. I never have these errors if I just execute the program (compiled as debug version). Any ideas?

Thanx

Sander Maréchal
[Lone Wolves Production][Articles][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Advertisement
You might be getting errors while debugging, but not when actually running, because the errors are simply not appearing when you''re running the program normally - that is, the errors are occuring, but the program is still running anyway.

By the way - using a debugger to detect memory leaks is called "extremely slack coding". If you don''t want to learn it, then you''re better off staying away from pointers.

-- The First AP Guy To Reply
As an addition-

If you''re running in "Debug Mode", VC++ might be fixing up your code errors, on-the-fly. Try compiling it non-debug, and see if it crashes or encounters errors.
Well, I do want to learn. I first tried to use the debugger when my texture manager screwed up big time and I couln''t find the error. I simply wrote a log function to do it manually. The engine got a little too big to find out why the debugger couln''t handle it.

I''ll try compiling it as a final. See what it does. And after that, I think i''ll throw everything out the window

I learned a lot since I started the engine and I''m going to do a total makeover. I just finished the basecode. Let see if I can make the booger debug-friendly

Sander Maréchal
[Lone Wolves Production][Articles][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

quote:Original post by Xces
To be honest that was the reason why i started this thread. I am kind new to C++, in VB all is done for you...


To an extent, VB does it for you. But you will find that there are cases where VB does have memory leaks, even with perfect code. Other times, Terminators never fire when you would assume they do.

I would suggest getting into the habit of explicitly setting all references to Nothing in VB. You can''t explicitly delete an object, but setting references to nothing will help ensure that VB doesn''t "forget" to deallocate memory for you.

And since VB uses reference counting for automatically deleting variables, it is easy to write objects that VB never cleans up for you. Take circular references, for example. If A holds a reference to B, and B holds a reference to A, neither will be freed.

Automatic deleting of objects is nice, but it helps to understand what is really going on.

--TheMuuj
--TheMuuj

This topic is closed to new replies.

Advertisement