delete-operator
Memory leak issue; deleting a pointer
If I have a pointer pointing to a specific memory address at the heap. I would like this same pointer to point to another memory address, should I first delete the pointer? But, in this case am I actu[详细]
2023-02-13 04:11 分类:问答Is it okay for an object to tell its owner to delete it
I have a scenario that is somewhat like this: class Owner { public: enum Type {TypeB, Type开发者_C百科C};[详细]
2023-02-10 13:58 分类:问答Dynamic memory allocation "delete"
If I allocated a memory location for an int object dynamically as follows: int *x = new int; After done with it, and want to free the memory on the heap, I开发者_如何学Go will do the following:[详细]
2023-02-07 03:57 分类:问答Was the behavior of deleting pointers-to-const changed in the past?
I got the following test code from http://support.microsoft.com/kb/131322: const int * pi= new int(1000);[详细]
2023-02-07 00:54 分类:问答Memory leak in C++ seems to get worse after adding delete statements
Edit: Can someone explain why adding the delete operators do not change the Valgrind output? Please do not ask me to read C++ books, I have browsed through a couple and have not found the answers ther[详细]
2023-02-05 21:24 分类:问答Destructor of class with pointer array C++
If I have a class with an array of pointers to another class Vehicle : class List { public: //stuff goes here[详细]
2023-02-05 13:04 分类:问答Deleting a dynamically allocated jagged array
I have an array of pointers that point to arrays of ints. I have made a hard coded array of ints (check \'array\' below) and I want to insert it into the array of pointers (check \'bar\' below), as fa[详细]
2023-02-04 06:52 分类:问答The difference between delete and delete[] in C++ [duplicate]
This question already has answers here: Closed 12 years ago. Possible Duplicate: delete vs delete[] operators in C++[详细]
2023-02-03 16:45 分类:问答Understanding C++ dynamic allocation
Consider the following code: class CString { private: char* buff; size_t len; public: CString(const char* p):len(0), buff(nullptr)[详细]
2023-02-03 16:08 分类:问答Usefulness of 'delete this' in member function [duplicate]
This question already has answers here: Closed 12 years ago. Possible Duplicates: Is it OK to use "delete this" to delete the current object?[详细]
2023-01-30 22:29 分类:问答