I learned C # and now I am learning C ++. The whole point of releasing memory is new to me, and I want to know when I need to worry about releasing memory, and when not.
From what I understand, the only case I have to worry about releasing memory is when I used the statement new, so I have to free the memory using delete.But in these cases there is no need to release memory:
new
delete
It's true? And are there other times when I have to worry about freeing up memory?
: new delete, new[] delete[] malloc free.
new[]
delete[]
malloc
free
++ , ; ry , std::vector std::unique_ptr.
std::vector
std::unique_ptr
, :
new/new[]
delete/delete[]
malloc/calloc
, . ++, malloc , , , , , , ., , , , : , C-based /API- , , .
, .
.. , , C ++, C, ++. p >