Thread: vector of std::string reported as leaks

  1. #16
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Quote Originally Posted by Bubba View Post
    class Console
            static void createInstance();
            static Console* getInstance();
            virtual ~Console();
            Console(const Console &obj);
            Console& operator = (const Console &obj);
            std::list<std::string> m_Messages;
    That's about all that needs shown. createInstance() is called during setup() which is called from the main process. After that getInstance() is used. Upon shutdown the destructor calls clear on m_Messages. Fairly straightforward, somewhat modified, singleton pattern.
    VS2008 complains about private constructors/destructors

  2. #17
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Ok. So is it saying the compiler cannot clean up the instance b/c it is private?? The whole singleton pattern relies on it. I don't think visibility of the dtor/ctor applies to the compiler cleaning up statics at program exit.
    Last edited by VirtualAce; 11-05-2008 at 08:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Replies: 13
    Last Post: 12-14-2007, 03:34 PM
  3. Improving my code
    By rwmarsh in forum C++ Programming
    Replies: 14
    Last Post: 07-08-2006, 11:18 AM
  4. Debugging help
    By cuddlez.ini in forum C++ Programming
    Replies: 3
    Last Post: 10-24-2004, 07:08 PM
  5. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM