C++ memory leak with class members
问题 Debug_VLD in VS2010 reveals some memory leaks that come from class member creation / initialization / deletion. my_member is a data member with type double*. In constructor, I have my_member = NULL ; Then in some method, i need to allocate memory for my_member . I cannot do so in constructor, since i dont know size of array yet, and/or size may different for different calls of the method. What i do in this method is checking if member is NULL. if so, i allocate space for it, if not, i can