Boost logo

Boost Users :

From: Rodrigo Serafim (rjws2_at_[hidden])
Date: 2003-09-11 15:29:23

first question: where on earth was boost while I was doing my last year project?
just thinking of the amount of trouble I could have saved if I knew about it... makes me bang my head against several
walls ;)

Well, I starter looking towards memory managment with other eyes after 90% of my bugs being directly originated form it.
So after looking on the boost memory library a question popped: how can I use smart pointers and pool toguether. In
particular intrusive pointers and/or pool, being the "and/or" essencial.

If i have class C all made and ready and now I want it work with smart pointers i just have to make a base class
RefCount, use multiple inheritance to contruct C_RC and i can have both things.
Problem is, now i want to use it in pool too, but my base class RefCount calls delete. My solution; make yet another
base class Poolable and override new and delete there.

Well to my surprise it worked but only in very special cases. I have to use pool<> and cant use object_pool<C_RC_P>
it crashes. Also it only works in MSVC6 in Release, in Debug it crashes.

In a nutshell, my questions:
- Is object_pool->malloc / free diferent in semantics from pool->malloc / free ?
- I dont mind using pool<> but doing pool<>(sizeof(C_RC_P)) isnt that typesafe, can I make it?
- Why does it crash in debug ?

I send the code in attatchement.

sorry abount the lengthy mail, too many question, too little time
Rodrigo Serafim

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at