I created an example application as shown below. I have a requirement to create 1024 * 1024 structures. Before calling the operator, newmy application consumes a certain amount of memory (say, 0.3 MB). After calling a new operator, the memory increases (say, 175 mb). After calling the operator, the deletememory decreases (say, 15 mb). So finally, there is a difference in memory. I looked at all the memory data from the task manager. I am confused, should this be considered a memory leak, or will this memory be released slowly? If not, how can I free this remaining memory?
struct testSt
{
bool check;
std::string testString;
};
int main()
{
testSt *testObj = new testSt[1024 * 1024];
delete[] testObj;
return 0;
}
source
share