 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Xiao-Hui Wu Guest
|
Posted: Sat Jan 17, 2004 3:16 am Post subject: help with Loki::Factory |
|
|
Hi, I need help on using Loki::Factory. Here is how I use it and the
problem I have:
I use a static Loki::Factory and registered in it some object
creators, which are Loki::Functor's with 1 int parameter. By default,
these functors uses Loki::SmallObject, which in turn uses
SmallObjectAllocator held as a PhoenixSingleton in the
Loki::SingletonHolder (see SmallObj.h in Loki library). Everything
worked fine except at the exit of the program. The problem is that on
exit, the program tries to destroy the PhoenixSingleton that holds the
SmallObjectAllocator before the functors registered in the static
factory. This triggers the assertion in
Loki::FixedAllocator::~FixedAllocator, because the memory used by the
SmallObjects has not been released.
Currently this is not a big problem for me. My questions are:
1. Is the singleton always destructed before any static object?
2. What would be a better way of doing achieving similar effect (i.e.,
static factory shared by objects of the same type)?
Thanks in advance
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|