Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2002-08-31 23:52:58


On Fri, Aug 30, 2002 at 01:53:44PM -0400, Thomas Wenisch wrote:
> 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.

It is not - the code is already written anyway. And by providing
the Allocator template argument it will be easy for users to pass on
an Allocator that uses pre-allocated memory as well. So I think your
example is only another reason to indeed provide an interface that
accepts to pass an Allocator type instead of always using the
std::allocator.

-- 
Carlo Wood <carlo_at_[hidden]>

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