Is there a way to write to a file within a replaced global operator new?
// simple operator new replacment
void* operator new(std::size_t bytes) {
std::ofstream log{"log.txt"};
log << bytes << " bytes allocated\n";
return std::malloc(bytes);
}
std::ofstream uses new, creating an infinite loop.