Click here to Skip to main content
15,879,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Disable All Breakpoints In Visual C++ 6.0 Pin
Moak7-Oct-10 0:49
Moak7-Oct-10 0:49 
GeneralRe: Disable All Breakpoints In Visual C++ 6.0 Pin
bleedingfingers7-Oct-10 1:37
bleedingfingers7-Oct-10 1:37 
GeneralRe: Disable All Breakpoints In Visual C++ 6.0 Pin
Moak7-Oct-10 2:05
Moak7-Oct-10 2:05 
QuestionRe: Disable All Breakpoints In Visual C++ 6.0 Pin
bleedingfingers7-Oct-10 2:36
bleedingfingers7-Oct-10 2:36 
AnswerRe: Disable All Breakpoints In Visual C++ 6.0 Pin
Moak7-Oct-10 4:15
Moak7-Oct-10 4:15 
QuestionMemory usage Pin
sonualex6-Oct-10 21:15
sonualex6-Oct-10 21:15 
AnswerRe: Memory usage Pin
Cedric Moonen6-Oct-10 21:29
Cedric Moonen6-Oct-10 21:29 
AnswerRe: Memory usage [modified] Pin
Aescleal6-Oct-10 22:51
Aescleal6-Oct-10 22:51 
The first thing to do is look for everywhere you use "new." Wherever you find these places see if you can change the object to an automatic/stack based object OR immediately assign the result of the new to a management object (something like std::shared_ptr or boost::shared_ptr).

If that doesn't work have a look at libraries you're using and understand how objects in that library work. So if you're using MFC understand why and how CWnd objects handle self deletion in PostNCDestroy. If you're using OpenSSL make sure (by automating it) that all your BIO objects are closed properly. And so on with other libraries...

The point here is that if you don't do any manual memory management you can't leak any memory. Manual memory management can take many forms (e.g. using a vector as a stack and not clearing popped entries) so it's not necessarily just looking for "new" but it's a good start.

Cheers,

Ash

PS: Just thought - if you're using lower level raw memory management stuff like malloc/free( from the C standard library), HeapAlloc/HeapFree (from the windows API) or even VirtualAlloc(also from the windows API) make sure you're balancing allocations with freeing using management objects.

So my zeroth bit of advice should have been "don't use any object management apart from new/delete in C++ unless you have a very good reason not to." Once you've done that you can start removing news from your code.

modified on Thursday, October 7, 2010 7:22 AM

QuestionRe: Memory usage Pin
sonualex12-Oct-10 23:37
sonualex12-Oct-10 23:37 
QuestionProgram crashes, log entries and map files Pin
Interrobang6-Oct-10 6:58
Interrobang6-Oct-10 6:58 
AnswerRe: Program crashes, log entries and map files Pin
Stephen Hewitt6-Oct-10 18:27
Stephen Hewitt6-Oct-10 18:27 
QuestionSOLVED memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) [modified] Pin
Vaclav_6-Oct-10 2:56
Vaclav_6-Oct-10 2:56 
QuestionRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
David Crow6-Oct-10 3:25
David Crow6-Oct-10 3:25 
AnswerRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Vaclav_6-Oct-10 3:33
Vaclav_6-Oct-10 3:33 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) PinPopular
David Crow6-Oct-10 4:00
David Crow6-Oct-10 4:00 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Vaclav_6-Oct-10 4:41
Vaclav_6-Oct-10 4:41 
AnswerRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
David Crow6-Oct-10 4:42
David Crow6-Oct-10 4:42 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Luc Pattyn6-Oct-10 4:44
sitebuilderLuc Pattyn6-Oct-10 4:44 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Moak6-Oct-10 6:45
Moak6-Oct-10 6:45 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Vaclav_6-Oct-10 7:40
Vaclav_6-Oct-10 7:40 
QuestionRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
David Crow6-Oct-10 8:20
David Crow6-Oct-10 8:20 
AnswerRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Luc Pattyn6-Oct-10 8:39
sitebuilderLuc Pattyn6-Oct-10 8:39 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Moak6-Oct-10 9:10
Moak6-Oct-10 9:10 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Richard MacCutchan6-Oct-10 9:25
mveRichard MacCutchan6-Oct-10 9:25 
GeneralRe: memcpy size over 1 MB fails - unhandled exeption / access violation ( VC++ 6.0 ) Pin
Luc Pattyn6-Oct-10 9:54
sitebuilderLuc Pattyn6-Oct-10 9:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.