I have a small application which has a memory leak.
To try to find when the memory leaks I overloaded the new operator, however the memory leaked without printing anything to the screen (which I told it to when I overloaded the new operator)
The operator is overloaded like this :
void* operator new(std::size_t sz)
{
std::cout << "Allocated new memory usng the new operator" << std::endl;
return std::malloc(sz);
}
So, can memory leaks be caused without the new operator?
If yes, what else could it be caused by? (not sure how many things it could be caused by.....)
Note : I do know that memory leaks are caused by allocating memory and then not deallocating it after.
Answer :
Turns out it was SDL (the game dev library) "who" allocated memory because I didn't close my font after using it.