Added enclosing classname to FixedMemPool diagnosis.
This commit is contained in:
parent
d21adcdca6
commit
fd6a68632e
4 changed files with 43 additions and 11 deletions
|
@ -28,7 +28,7 @@
|
|||
#define _SVMEMPOOL_HXX
|
||||
|
||||
#include "tools/toolsdllapi.h"
|
||||
#include <tools/solar.h>
|
||||
#include "tools/solar.h"
|
||||
|
||||
// ----------------
|
||||
// - FixedMemPool -
|
||||
|
@ -39,9 +39,11 @@ struct FixedMemPool_Impl;
|
|||
class TOOLS_DLLPUBLIC FixedMemPool
|
||||
{
|
||||
FixedMemPool_Impl * m_pImpl;
|
||||
char const * m_pTypeName;
|
||||
|
||||
public:
|
||||
FixedMemPool( USHORT nTypeSize,
|
||||
FixedMemPool( char const * pTypeName,
|
||||
USHORT nTypeSize,
|
||||
USHORT nInitSize = 512,
|
||||
USHORT nGrowSize = 256 );
|
||||
~FixedMemPool();
|
||||
|
@ -97,8 +99,11 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool )
|
|||
DECL_FIXEDMEMPOOL_NEW_INLINE( Class, aPool ) \
|
||||
DECL_FIXEDMEMPOOL_DEL_INLINE( Class, aPool )
|
||||
|
||||
#define IMPL_FIXEDMEMPOOL_STRING(x) IMPL_FIXEDMEMPOOL_MAKESTRING(x)
|
||||
#define IMPL_FIXEDMEMPOOL_MAKESTRING(x) #x
|
||||
|
||||
#define IMPL_FIXEDMEMPOOL_NEWDEL( Class, InitSize, GrowSize) \
|
||||
FixedMemPool Class::aPool( sizeof( Class ), (InitSize), (GrowSize) );
|
||||
FixedMemPool Class::aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) );
|
||||
|
||||
#define DECL_FIXEDMEMPOOL_NEWDEL_DLL( Class ) \
|
||||
private: \
|
||||
|
@ -108,13 +113,13 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool )
|
|||
DECL_FIXEDMEMPOOL_DEL_DECL();
|
||||
|
||||
#define IMPL_FIXEDMEMPOOL_NEWDEL_DLL( Class, InitSize, GrowSize) \
|
||||
FixedMemPool Class::aPool( sizeof( Class ), (InitSize), (GrowSize) ); \
|
||||
FixedMemPool Class::aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) ); \
|
||||
DECL_FIXEDMEMPOOL_NEW_IMPL( Class ) \
|
||||
IMPL_FIXEDMEMPOOL_NEW_BODY( Class, aPool ) \
|
||||
DECL_FIXEDMEMPOOL_DEL_IMPL( Class ) \
|
||||
IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool )
|
||||
|
||||
#define INIT_FIXEDMEMPOOL_NEWDEL_DLL( class, aPool, InitSize, GrowSize ) \
|
||||
aPool( sizeof( class ), InitSize, GrowSize )
|
||||
#define INIT_FIXEDMEMPOOL_NEWDEL_DLL( Class, aPool, InitSize, GrowSize ) \
|
||||
aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) )
|
||||
|
||||
#endif // _SVMEMPOOL_HXX
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_tools.hxx"
|
||||
|
||||
#include <tools/mempool.hxx>
|
||||
#include "tools/mempool.hxx"
|
||||
#include "osl/diagnose.h"
|
||||
#include "rtl/alloc.h"
|
||||
|
||||
#ifndef INCLUDED_STDIO_H
|
||||
|
@ -42,11 +43,13 @@
|
|||
*************************************************************************/
|
||||
|
||||
FixedMemPool::FixedMemPool (
|
||||
USHORT _nTypeSize, USHORT, USHORT)
|
||||
char const * pTypeName, USHORT nTypeSize, USHORT, USHORT)
|
||||
: m_pTypeName (pTypeName)
|
||||
{
|
||||
char name[RTL_CACHE_NAME_LENGTH + 1];
|
||||
snprintf (name, sizeof(name), "FixedMemPool_%d", (int)_nTypeSize);
|
||||
m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, _nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0);
|
||||
snprintf (name, sizeof(name), "FixedMemPool_%d", (int)nTypeSize);
|
||||
m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0);
|
||||
OSL_TRACE("FixedMemPool::ctor(\"%s\"): %p", m_pTypeName, m_pImpl);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -57,7 +60,8 @@ FixedMemPool::FixedMemPool (
|
|||
|
||||
FixedMemPool::~FixedMemPool()
|
||||
{
|
||||
rtl_cache_destroy ((rtl_cache_type*)(m_pImpl));
|
||||
OSL_TRACE("FixedMemPool::dtor(\"%s\"): %p", m_pTypeName, m_pImpl);
|
||||
rtl_cache_destroy ((rtl_cache_type*)(m_pImpl)), m_pImpl = 0;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
|
|
@ -62,6 +62,11 @@ APP3TARGET = inetmimetest
|
|||
APP3OBJS = $(OBJ)$/inetmimetest.obj
|
||||
APP3STDLIBS = $(SALLIB) $(TOOLSLIB)
|
||||
|
||||
APP4TARGET = mempooltest
|
||||
APP4OBJS = $(OBJ)$/mempooltest.obj
|
||||
APP4STDLIBS = $(TOOLSLIB)
|
||||
APP4RPATH = UREBIN
|
||||
|
||||
# APP3TARGET = tldem
|
||||
# APP3OBJS = $(OBJ)$/tldem.obj
|
||||
# .IF "$(GUI)" == "UNX"
|
||||
|
|
18
tools/workben/mempooltest.cxx
Normal file
18
tools/workben/mempooltest.cxx
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "tools/mempool.hxx"
|
||||
|
||||
struct MempoolTest
|
||||
{
|
||||
int m_int;
|
||||
|
||||
DECL_FIXEDMEMPOOL_NEWDEL(MempoolTest);
|
||||
};
|
||||
|
||||
IMPL_FIXEDMEMPOOL_NEWDEL(MempoolTest, 0, 0);
|
||||
|
||||
int main()
|
||||
{
|
||||
MempoolTest * p = new MempoolTest();
|
||||
if (p != 0)
|
||||
delete p;
|
||||
return 1;
|
||||
}
|
Loading…
Reference in a new issue