View Single Post
  #2  
Old 11-17-2003, 03:21 AM
Merth
Dragon
 
Join Date: May 2003
Location: Seattle, WA
Posts: 609
Default

This is how I interpreted your argument:

When an exception is thrown, stack memory is cleaned up, but heap memory is not. Pointers are on the stack, but the memory they point to is on the heap. When an exception is thrown, we have a mem leak for whatever a stack pointer was pointing to. Wrapping the pointer into a smart pointer will avoid this situation.

However, I do see some issues:
* Most of the team codes in C.
* What are the situations that would cause an exception to be thrown?
* What is the typical way to cache a wrapped pointer? (one that works on linux, so no GIT)
* With regard to auto_ptr, how would it know whether to call delete versus delete[]?
Reply With Quote