2

Does anyone have an idea how Application Verifier works?

I am currently working on a tree parsing application, which heavily uses recursion. The program seems to work as intended, however I do use "new" in a few places, so I thought of checking for memory leaks with Application Verifier. AV doesn't report any errors, however, in a couple of minutes the image of the application quickly grows to about a gigabyte, whereas without it only got to around 60 megs. I can't seem to find any memory leaks, and seeing how much recursion is going on, I am starting to suspect that AV places extra items on the stack for testing purposes, and as the recursion goes deeper the extra "junk" builds up and crashes the program.

Does anyone have any insight into the matter?

LakatosI
  • 395
  • 1
  • 3
  • 9

1 Answers1

1

It may depend which AppVerifier features you've turned on. There's a heap checking feature that puts each allocation in its own page and allocates guard pages between allocations. If you're allocating lots of small objects, this feature will dramatically increase memory usage. This is normal behavior for this kind of testing and not something to worry about.

Off hand, I don't know of any features that affect stack usage. I believe it would be difficult to mess with the stack without recompiling the code with instrumentation, and AppVerifier doesn't require compiling with instrumentation.

Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175
  • I am allocating lots of objects, so this might just be the reason form y problem, although I do free the memory of the objects. Does AppVerifier somehow mess with deallocation as well? Hm, or maybe I'm only freeing memory *after* the recursive call, so the objects just build up. I'll have to check. – LakatosI Aug 01 '12 at 05:44
  • Also, I am using the tests that AV selects by default. I looked through my code, and the problem isn't with me freeing memory too late. – LakatosI Aug 01 '12 at 08:48