-1
int i=4;
int *p = new int(17);
i = *p;
delete p; 
p=0;

How to count how much memory is leaked? Is there like a unit to count this in?

Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251
TNT_42
  • 43
  • 1
  • 5

1 Answers1

0

There's a lot of variables involved, such as how 'new' or malloc actually work so it's hard to quantify with exact figures. But since there's no garbage collection involved you can try a few things. One thing I've done before is wrap the suspect code in a tight loop and watch the memory growth.

seand
  • 5,168
  • 1
  • 24
  • 37