C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help with Loki::Factory

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Xiao-Hui Wu
Guest





PostPosted: Sat Jan 17, 2004 3:16 am    Post subject: help with Loki::Factory Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.