Original Post
Memory leaks as we all know are an annoying problem. But again I'm sort of hung up trying to think of a way to avoid them. I know how smart/intrusive pointers work and how to use them, but this feels like an incomplete solution. If I forget to use a smart pointer I could potentially leave some memory undeleted, thus causing a leak. I'm wondering what people have used as solutions to memory problems. Ideally I'd like some sort of solution that causes a very clear runtime error if a memory leak is allowed. It should allow me to see what memory I forgot to delete, etc. Currently the only solution I can think of is to allocate some big pool of memory at the beginning of my program, then force (somehow, overloaded new perhaps?) everyone to use that pool and tag the memory they allocate so that at the end of the program I can see if there are any remaining tags. The problem is that this solution seems somewhat inflexible. Is this much security even necessary? Are there other possible solutions that anyone knows of? I know this is a very broad subject and the correct solution depends highly on what type of application is being written, but I think for now I'd just like to see what solutions people have used to give me an idea of what's out there. Any ideas would be appreciated. Sam