Click here to Skip to main content
15,903,856 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ language updates / old C++ code Pin
HobbyProggy15-May-24 20:35
professionalHobbyProggy15-May-24 20:35 
AnswerRe: C++ language updates / old C++ code Pin
jschell15-May-24 14:29
jschell15-May-24 14:29 
GeneralRe: C++ language updates / old C++ code Pin
HobbyProggy15-May-24 20:41
professionalHobbyProggy15-May-24 20:41 
GeneralRe: C++ language updates / old C++ code Pin
jschell16-May-24 12:10
jschell16-May-24 12:10 
QuestionCan this be the cause of a memory leak Pin
Calin Negru9-May-24 2:50
Calin Negru9-May-24 2:50 
AnswerRe: Will this generate a memory leak Pin
Victor Nijegorodov9-May-24 3:05
Victor Nijegorodov9-May-24 3:05 
GeneralRe: Will this generate a memory leak Pin
Calin Negru9-May-24 3:37
Calin Negru9-May-24 3:37 
GeneralRe: Will this generate a memory leak Pin
k50549-May-24 4:32
mvek50549-May-24 4:32 
With a memory leak, the memory footprint of the running process increases over time. If the conditions that lead to the leak are encountered often enough, the process will eventually run out of available memory, usually causing an exception of some sort. Unless you're in a very specialized environment, the memory associated with the process gets released when it exits. That means that the overall memory on the system doesn't get incrementally consumed over time. So you really only run the risk of the one process running out of memory, not the system as a whole. I hope I've explained that clearly enough.

Some system calls (and some user written functions!) use this to their advantage. On the first call they will allocate some memory, and then reuse it on successive calls. With no cleanup routine, they just rely on the program exit to do the memory release. That's why you might get notice of memory in use at exit when running a program under a memory diagnostic tool like Valgrind. When you trace back to where the memory was allocated, it might be inside something like fopen().
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown

GeneralRe: Will this generate a memory leak Pin
Calin Negru9-May-24 4:49
Calin Negru9-May-24 4:49 
GeneralRe: Will this generate a memory leak Pin
k50549-May-24 5:51
mvek50549-May-24 5:51 
AnswerRe: Can this be the cause of a memory leak Pin
Mircea Neacsu9-May-24 3:23
Mircea Neacsu9-May-24 3:23 
AnswerRe: Can this be the cause of a memory leak Pin
CPallini9-May-24 3:28
mveCPallini9-May-24 3:28 
GeneralRe: Can this be the cause of a memory leak Pin
Calin Negru9-May-24 4:53
Calin Negru9-May-24 4:53 
GeneralRe: Can this be the cause of a memory leak Pin
CPallini9-May-24 4:58
mveCPallini9-May-24 4:58 
QuestionUSB power control Pin
etechX29-May-24 18:27
etechX29-May-24 18:27 
AnswerRe: USB power control Pin
jschell9-May-24 15:31
jschell9-May-24 15:31 
AnswerRe: USB power control Pin
RedDk10-May-24 8:24
RedDk10-May-24 8:24 
AnswerRe: USB power control Pin
charlieg20-May-24 4:44
charlieg20-May-24 4:44 
Questionforeach....recursively - assistance with C++ code wnated Pin
Salvatore Terress8-May-24 6:08
Salvatore Terress8-May-24 6:08 
AnswerRe: foreach....recursively - assistance with C++ code wnated Pin
k50548-May-24 7:03
mvek50548-May-24 7:03 
GeneralRe: foreach....recursively - assistance with C++ code wnated Pin
Salvatore Terress8-May-24 8:19
Salvatore Terress8-May-24 8:19 
GeneralRe: foreach....recursively - assistance with C++ code wnated Pin
k50548-May-24 8:57
mvek50548-May-24 8:57 
GeneralRe: foreach....recursively - assistance with C++ code wnated Pin
Salvatore Terress8-May-24 17:09
Salvatore Terress8-May-24 17:09 
GeneralRe: foreach....recursively - assistance with C++ code wnated Pin
Salvatore Terress10-May-24 13:23
Salvatore Terress10-May-24 13:23 
Questionvoluntarily REMOVED Which way is correct ? Pin
Salvatore Terress6-May-24 10:19
Salvatore Terress6-May-24 10:19 

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.