Hi list,

Is it possible to detect memory leaks with Memcheck in the code below?

--
class Singleton
{
public:
        static Singleton* instance()
        {
                if(!instance_)
                        instance_ = new Singleton();
                return instance_;
        }

private:
        Singleton() { }
        ~Singleton() { }

private:
        static Singleton* instance_;
};
Singleton* Singleton::instance_ = 0;

int main()
{
        Singleton::instance();
        return 0;
}
--

If answer is yes – how can I do it? If no – why? This is definitely a  
leak in a heap.

Thanks,
AlekSi.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to