On 03/02/2009 10:36 AM, Kinkie wrote:
> BUT MemPools are initialized AFTER global variables, and thus a global
> definition such as:
> SBuf foo("some initializer");
> causes the SBuf to grow()
> which calls memAllocString
> which tries to locate a pool, and fails because the pools are not yet ready.
> (run...)
> at program exit()
> ~SBuf
> calls ~MemBlob
> which calls memFreeString
> which asserts unless by sheer chance the MemBlob has the exact same
> size of a pool, and if it does the results are unpredicatable anyways.
>
> Hacking my way around this is painful, and is causing me to touch
> things I'd really rather not touch as much (mem.cc)
> isLiteral/isImported had the dubious advantage of flagging in the
> object themselves whether they were obtained from pools or from some
> form of malloc or string constant. I can't really imagine a different
> solution which doesn't break layering.
>
> Do you have any suggestion?
>
Do not use memory pools for StingNg strings, for now. MemPools need to
be fixed to work at startup time but that fix is out of this project scope.
HTH,
Alex.