This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: void S::g(S::N* n) . How can I test for memory leaks? That's a hard problem in general. If we limit it to checking whether we leak any linked list nodes, where each linked list node contains an object of the type stored in the Set, then we can do it this way: Declare the element type of the Set to be a special class we'll write, one that will keep track of all creations and deletions of objects of that special type. We can do this by instrumenting every constructor and the destructor of that special class. Then we run our tests and see if the number of destructions equals the number of constructions, as shown in some sample code ....
View Full Document
This note was uploaded on 11/07/2009 for the course CS 32 taught by Professor Davidsmallberg during the Winter '08 term at UCLA.
- Winter '08