Home > Back-end >  About the memory leak problem
About the memory leak problem

Time:11-06


Why use static statement string will appear memory leak out the information?


Put the string in the main local wouldn't,

Speculation is memory leak detection than string destructor step in first?

Master for guidance

CodePudding user response:

Yes, global object of TMP destructor is in _tmain () function returns after, expanded the object-oriented thought to c + + program, namely the process as an object, the program object lifetime of three phases: (1) the program structure: all global variables (or object) initialization (or structure); (2) the program activities: that executes _tmain () function. (3) program destructor: all global variables (or object) of death (or destructor), see "the essence of c + + programming tutorial" in the fourth chapter examples, if abort will not execute (3),
  • Related