examples_cpp
examples_cpp copied to clipboard
Leaking memory?
The custom deleter lambda function is not actually deleting the object.
https://github.com/eth-cscs/examples_cpp/blob/ed913202222dbdc45066900da7ab408249587bfd/Code/SmartPtrs/deleters_7.cpp#L34
Isn't this leaking memory? I guess the correct version should be
auto deleter = [fileName](Object* ptr){
ptr->dumpToFile(fileName);
delete ptr;
};