AFIK valgrind can do this. Like max amount memory used during runtime.

But you see the problem that cloning the data is not a valid solution?