Boost logo

Boost :

From: Thomas Wenisch (twenisch_at_[hidden])
Date: 2002-08-30 12:53:44


On Fri, 30 Aug 2002, Daniel Frey wrote:

> Rob Stewart wrote:
> >
> > Given that your demangling logic will be invoked in almost every
> > use case strictly for error reporting, performance is not an
> > issue. Therefore, any performance concern wrt copying strings is
> > moot.
>
> It's not just about performance. Errors may occur when the system is
> short of memory, thus you should try be avoid memory allocations
> whenever possible (OK, string will most likely not be a real problem,
> put you never know...).
>
> Regards, Daniel
>

I think Daniel has a really good point here. If you really intend to use
the demangler in a hard-core debug library (ie debugging code in a
memory-constrained embedded system), then it is important that the debug
code does not allocate ANY memory or other resources at the time an error
is detected - resources/memory need to be reserved in advance.

By the same token, I think that it is a LOT of work to get a demangler
that only uses pre-allocated memory, and it may not even be possible, so
I'm not sure that this should be a design goal of a general-purpose name
demangling library. Such a demangler would probably have to be tightly
integrated with the rest of your debugging framework (ie stack trace
capture without allocating memory, exceptions that use pre-allocated
memory, etc). Since this is not the most common use case, IMHO, I believe
the extremely low memory situation should not be a primary concern now.

Regards,
-Tom Wenisch
Computer Architecture Lab
Carnegie Mellon University


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk