Click here to Skip to main content
15,902,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: About C++ Project (Please help, I am so worry about this) Pin
Rick York29-Jul-08 7:17
mveRick York29-Jul-08 7:17 
AnswerRe: About C++ Project (Please help, I am so worry about this) Pin
Cedric Moonen29-Jul-08 7:34
Cedric Moonen29-Jul-08 7:34 
AnswerRe: About C++ Project (Please help, I am so worry about this) Pin
killabyte29-Jul-08 12:24
killabyte29-Jul-08 12:24 
AnswerRe: About C++ Project (Please help, I am so worry about this) Pin
Hamid_RT29-Jul-08 22:48
Hamid_RT29-Jul-08 22:48 
QuestionVERY basic memory question Pin
__DanC__29-Jul-08 6:08
__DanC__29-Jul-08 6:08 
AnswerRe: VERY basic memory question Pin
toxcct29-Jul-08 6:15
toxcct29-Jul-08 6:15 
GeneralRe: VERY basic memory question Pin
__DanC__29-Jul-08 6:17
__DanC__29-Jul-08 6:17 
GeneralRe: VERY basic memory question Pin
toxcct29-Jul-08 6:33
toxcct29-Jul-08 6:33 
to be very clear here is what happens with this code:
char* pArray = new char[123];

a variable pArray of type pointer to char is created on the stack.
then, a block of 123 chars is allocated on the heap.
the address of the just allocated memory is stored into the pointer variable you have on the stack (pArray).

so, if you put such a code into a scope, and if you don't free the memory allocated before going out of scope, the variable on the stack is destroyed, but not the memory block on the heap.
so you just loose the reference (the address) to your allocated memory on the heap, hence the memory leak...


GeneralRe: VERY basic memory question Pin
Cedric Moonen29-Jul-08 7:32
Cedric Moonen29-Jul-08 7:32 
GeneralRe: VERY basic memory question Pin
Joe Woodbury29-Jul-08 8:50
professionalJoe Woodbury29-Jul-08 8:50 
GeneralRe: VERY basic memory question Pin
Yajnesh Narayan Behera29-Jul-08 19:10
Yajnesh Narayan Behera29-Jul-08 19:10 
GeneralRe: VERY basic memory question Pin
Joe Woodbury30-Jul-08 5:11
professionalJoe Woodbury30-Jul-08 5:11 
QuestionOwnerdrawn Listbox Pin
KellyR29-Jul-08 4:23
KellyR29-Jul-08 4:23 
AnswerRe: Ownerdrawn Listbox Pin
led mike29-Jul-08 4:36
led mike29-Jul-08 4:36 
GeneralRe: Ownerdrawn Listbox Pin
KellyR29-Jul-08 4:38
KellyR29-Jul-08 4:38 
GeneralRe: Ownerdrawn Listbox Pin
led mike29-Jul-08 5:10
led mike29-Jul-08 5:10 
GeneralRe: Ownerdrawn Listbox Pin
KellyR29-Jul-08 5:30
KellyR29-Jul-08 5:30 
AnswerRe: Ownerdrawn Listbox Pin
Mark Salsbery29-Jul-08 6:32
Mark Salsbery29-Jul-08 6:32 
QuestionExecuting Query like (where) expressions on data stored in structure in c++ Pin
NileshBhatkhalkar29-Jul-08 4:12
professionalNileshBhatkhalkar29-Jul-08 4:12 
AnswerRe: Executing Query like (where) expressions on data stored in structure in c++ Pin
led mike29-Jul-08 4:35
led mike29-Jul-08 4:35 
QuestionGlobalization/Localization in VC++ [modified] Pin
Andy Rama29-Jul-08 3:31
Andy Rama29-Jul-08 3:31 
AnswerRe: Globlization in VC++ Pin
toxcct29-Jul-08 3:46
toxcct29-Jul-08 3:46 
GeneralRe: Globlization in VC++ Pin
Maximilien29-Jul-08 3:50
Maximilien29-Jul-08 3:50 
GeneralRe: Globlization in VC++ Pin
Andy Rama29-Jul-08 5:47
Andy Rama29-Jul-08 5:47 
GeneralRe: Globlization in VC++ Pin
toxcct29-Jul-08 5:59
toxcct29-Jul-08 5:59 

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.