关于 boost:condition_variable的使用,求高手解答?该如何处理

关于 boost::condition_variable的使用,求高手解答????
从网上找到的生产者消费者队列代码,基于boost的条件变量实现的。
段代码横看树看也没有什么问题,于是在正式的项目中使用了。但结果很受伤,出现了严重的资源泄露,
以上不知道是我的使用方法有问题,还是BOOST本身的BUG,望大家指导。

调试发现:
主要表现为同步对象泄露,
问题代码行:the_condition_variable.wait(lock);

编译环境:
VS2008
boost版本1.52

运行环境:
Windows Server 2003 23位
内存8G

附上源代码:

template<typename Data>  
class concurrent_queue  
{  
private:  
    std::queue<Data> the_queue;  
    mutable boost::mutex the_mutex;  
    boost::condition_variable the_condition_variable;  
public:  
    void push(Data const& data)  
    {  
        boost::mutex::scoped_lock lock(the_mutex);  
        the_queue.push(data);  
        lock.unlock();  
        the_condition_variable.notify_one();  
    }  
    bool empty() const 
    {  
        boost::mutex::scoped_lock lock(the_mutex);  
        return the_queue.empty();  
    }  
    bool try_pop(Data& popped_value)  
    {  
        boost::mutex::scoped_lock lock(the_mutex);  
        if(the_queue.empty())  
        {  
            return false;  
        }  
           
        popped_value=the_queue.front();  
        the_queue.pop();  
        return true;  
    }  
    void wait_and_pop(Data& popped_value)  
    {  
        boost::mutex::scoped_lock lock(the_mutex);  
        while(the_queue.empty())  
        {  
            the_condition_variable.wait(lock);  
        }  
           
        popped_value=the_queue.front();  
        the_queue.pop();  
    }  
};

原文:http://www.cnblogs.com/sanjin/archive/2012/08/09/2629890.html
------解决方案--------------------
似乎没看见你delete操作
------解决方案--------------------
怎么你的只有push里lock和unlock是成对出现  其他函数都只lock了?  
------解决方案--------------------
硬是看不出问题,换其他类型的锁看看!
------解决方案--------------------
不明觉历关于 boost:condition_variable的使用,求高手解答?该如何处理
------解决方案--------------------
    void push(Data const& data)  
    {  
        {
             boost::mutex::scoped_lock lock(the_mutex);  
             the_queue.push(data);  
        }
        the_condition_variable.notify_one();  
    }  

该这么写吧