Topic: Memory usage of the standard library


Author: Mike Davies <mike_davies@noco.demon.co.uk>
Date: 1998/07/08
Raw View
In article <MPG.1006d03dc8317b4a989b76@news.rmi.net>, Jerry Coffin
<jcoffin@taeus.com> writes

>An obvious example would be vector<> -- I don't
>believe anybody's come up with a way of increasing its size in
>amortized constant time without involving average memory waste equal
>to a percentage of the current size of the contents (typically ~25%.)

I guess its anodyne to say that not every feature provided by a general
purpose library will find an application in every project.
If your memory constrained embedded project needs a vector that can
increase its size in constant time, however then I would try vector<>
from the STL first - if you wrote your own version it might be *less*
space efficient.


--
Mike Davies
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: jcoffin@taeus.com (Jerry Coffin)
Date: 1998/07/03
Raw View
In article <mOYY3OAGw8m1EwYW@noco.demon.co.uk>,
mike_davies@noco.demon.co.uk says...

[ ... ]

> The current status of this discussion AFAI have been able to discern is
> that the *language* does not require any overhead for iostreams, but
> that specific implementations (particularly those that don't use weak
> references as an efficiency aid) do currently have overheads.

I think if you restrict this entirely to iostreams, it's more or less
true.  I'm not sure even with weak references you can necessarily
reduce the size to be as small as with, e.g. some older versions of
iostreams.  However, I think we'll all agree that with care, it can be
gotten a lot closer than current implementations actually DO.

OTOH, there are other parts of the library for which this does NOT
appear to be true.  An obvious example would be vector<> -- I don't
believe anybody's come up with a way of increasing its size in
amortized constant time without involving average memory waste equal
to a percentage of the current size of the contents (typically ~25%.)

--
    Later,
    Jerry.

The Universe is a figment of its own imagination.


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]