[vlmc-devel] Remove unused MemoryPool class

Hugo Beauzée-Luyssen git at videolan.org
Mon Jul 4 15:34:27 CEST 2016


vlmc | branch: medialibrary | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jun 27 16:32:53 2016 +0200| [efa9ea74991509720a9c271a95a275ae5b0a5aca] | committer: Hugo Beauzée-Luyssen

Remove unused MemoryPool class

> https://code.videolan.org/videolan/vlmc/commit/efa9ea74991509720a9c271a95a275ae5b0a5aca
---

 src/CMakeLists.txt       |  1 -
 src/Tools/MemoryPool.hpp | 77 ------------------------------------------------
 2 files changed, 78 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0c2ddfc..4e09414 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -92,7 +92,6 @@ SET(VLMC_SRCS
     Settings/Settings.cpp
     Settings/SettingValue.cpp
     Tools/ErrorHandler.cpp
-    Tools/MemoryPool.hpp
     Tools/RendererEventWatcher.cpp
     Tools/OutputEventWatcher.cpp
     Tools/Singleton.hpp
diff --git a/src/Tools/MemoryPool.hpp b/src/Tools/MemoryPool.hpp
deleted file mode 100644
index 15e9d76..0000000
--- a/src/Tools/MemoryPool.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*****************************************************************************
- * MemoryPool.hpp: Generic memory pool, that will reinstantiate
- * a new object each time
- *****************************************************************************
- * Copyright (C) 2008-2016 VideoLAN
- *
- * Authors: Hugo Beauzee-Luyssen <hugo at vlmc.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef MEMORYPOOL_HPP
-#define MEMORYPOOL_HPP
-
-#include <QMutex>
-#include <QQueue>
-
-#include "Singleton.hpp"
-#include "VlmcDebug.h"
-
-template <typename T, size_t NB_ELEM = 5>
-class       MemoryPool : public Singleton< MemoryPool<T, NB_ELEM> >
-{
-public:
-    T*      get()
-    {
-        QMutexLocker    lock( m_mutex );
-        if ( m_pool.size() == 0 )
-        {
-            vlmcCritical() << "Pool is empty !!";
-            return new T;
-        }
-        quint8*    ptr = m_pool.dequeue();
-        T*  ret = new (ptr) T;
-        return ret;
-    }
-    void    release( T* toRelease )
-    {
-        QMutexLocker    lock( m_mutex );
-        toRelease->~T();
-        m_pool.enqueue( reinterpret_cast<quint8*>( toRelease ) );
-    }
-private:
-    MemoryPool()
-    {
-        for ( size_t i = 0; i < NB_ELEM; ++i )
-            m_pool.enqueue( new quint8[ sizeof(T) ] );
-        m_mutex = new QMutex;
-    }
-    ~MemoryPool()
-    {
-        while ( m_pool.size() != 0 )
-        {
-            quint8*  ptr = m_pool.dequeue();
-            delete ptr;
-        }
-        delete m_mutex;
-    }
-    QQueue<quint8*>     m_pool;
-    QMutex*             m_mutex;
-    friend class Singleton< MemoryPool<T> >;
-};
-
-#endif // MEMORYPOOL_HPP
-



More information about the Vlmc-devel mailing list