-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
  • 148,243
  • 22
  • 160
  • 229
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,132
  • 1
  • 23
  • 37