I added these files to the email, but I will also post them here:
portlibInit.h
// Include file for initializing this librarie

#include "os/OsTimerTask.h"
#include "os/OsLock.h"
#include "os/OsNameDb.h"
#include "utl/UtlLink.h"
#include "utl/UtlListIterator.h"


class portlib{
private:
// instance pointer
static portlib* PortLibInstance;
// constructor no arguments
portlib();
// destructor no arguments
~portlib();
// the initcounter should be static because it is used for counting the
// created objects.
static int initcounter;
public:
static OsBSem* OsTimerTaskLock;
static UtlChainPool* linkPairPool;
static void Init( void );
static void Shutdown( void );
};

portlibInit.cpp
// used for initilisation of global stuff, semaphores etc.

#include "portlibInit.h"

#ifndef UTLLINK_BLOCK_SIZE
#define UTLLINK_BLOCK_SIZE 1000
#endif

int portlib::initcounter = 0;
portlib* portlib::PortLibInstance = NULL;
OsBSem* portlib::OsTimerTaskLock = NULL;
UtlChainPool* portlib::linkPairPool = NULL;

void portlib::Init( void ){
if( PortLibInstance == NULL ){
PortLibInstance = new portlib();
}
initcounter++;
}

void portlib::Shutdown( void ){
initcounter--;
// no more inits left, remove instance
if( initcounter == 0 ){
delete PortLibInstance;
}
}
// private constructor, is only called indirect via Init
portlib::portlib( void ){
OsTimerTaskLock = new OsBSem(OsBSem::Q_PRIORITY, OsBSem::FULL);
UtlPair::spPairPool = new UtlChainPool(UtlPair::allocate,
UTLLINK_BLOCK_SIZE);
UtlLink::spLinkPool = new UtlChainPool(UtlLink::allocate,
UTLLINK_BLOCK_SIZE);
UtlContainer::spIteratorConnectionLock = new OsBSem(OsBSem::Q_PRIORITY,
OsBSem::FULL);
UtlListIterator::NOWHERE = new UtlLink;
OsNameDb::spLock = new OsBSem(OsBSem::Q_PRIORITY, OsBSem::FULL);
OsSysLog::spPriorities = new OsSysLogPriority[FAC_MAX_FACILITY] ;
}

portlib::~portlib( void ){
delete OsTimerTaskLock;
delete UtlPair::spPairPool;
delete UtlLink::spLinkPool;
delete UtlContainer::spIteratorConnectionLock;
delete UtlListIterator::NOWHERE;
delete OsNameDb::spLock;
delete OsSysLog::spPriorities;
}

I'm using visual leak detector
1.0<http://www.codeproject.com/tools/visualleakdetector.asp>to detect
te leaks, Im currently using the media update branche. Which
branche do you recommend? And what is the URL of that repo?


2007/5/7, Jaroslav Libák <[EMAIL PROTECTED]>:

You didn't include portlibInit.cpp and portlibInit.h. My idea was that all
classes that have private static variables initialized using new, would also
have methods staticInitialize and staticUninitialize which would do
new/delete. Then portlibinit would only call these methods. Btw there are
also some undeleted singletons in sipxmedialib and sipxtacklib. What
software did you use to detect them?

Your patch is also for older revision. You need to make it for the latest
revision as there have been some changes in the code you are modifying.

Jaro
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to