If so, and you're using Visual Studio, then the debug version of the Microsoft CRT provides _CrtMemCheckpoint which works like you want. But this is just for debug diagnostic purposes. https://msdn.microsoft.com/en-us/library/h3z85t43.aspx
I have no idea what's provided (if anything) by MinGW or CYGWIN, but as neither of them have a crtdbg.h it's unlikely to be the same mechanism. And I have no idea of the score when it comes to Linux (etc.)