Re: Custom allocator sample code for vector

From: Alex Vinokur (alexvn_at_big-foot.com)
Date: 08/16/04


Date: Mon, 16 Aug 2004 14:25:06 +0300


"Alex Vinokur" <alexvn@big-foot.com> wrote in message news:2ns0hgF3vdnqU1@uni-berlin.de...
>
[snip]
> Here is the Nicolai M. Josuttis' code sample with cosmetic changes added by me to profile the executable:
> http://groups.google.com/groups?threadm=2nrba8F3sq7sU1%40uni-berlin.de
>
> Here are log files for the following compilers
> * GNU g++ : http://groups.google.com/groups?selm=2nrb31F3q19kU1%40uni-berlin.de
[snip]
>
> We can see that
> * GNU g++ 3.3.1 doesn't invoke construct() and destroy();
[snip]

"Matt Austern" <austern@apple.com> wrote in message
http://article.gmane.org/gmane.comp.gcc.libstdc++.devel/9815

> On Jul 19, 2004, at 9:25 AM, pippadav@dei.unipd.it wrote:
>
> > Hi everybody !
> >
> > There's a behaviour in STL allocator I don't understand, I hope
> > somebody can
> > help me...
> >
> > I'm trying to customize an allocator to track the insertion/deletion
> > of objects
> > in a container,
> > decorating the standard allocator functions construct() and destroy().
> >
> > The problem is that it seems that those functions are never called in
> > STL
> > containers, instead
> > a global template function _Construct() (defined in <stl_construct.h>)
> > is
> > called, that is
> > completely unaware of allocators.
>
> This is a bug.
[snip]

See also several relevant threads from news://news.gmane.org/gmane.comp.gcc.libstdc++.devel

The thread titled "Custom allocator for vector and libstdc++-v3"
http://thread.gmane.org/gmane.comp.gcc.libstdc++.devel/10087

The thread titled "allocator construct() / destruct() behaviour..."
http://thread.gmane.org/gmane.comp.gcc.libstdc++.devel/9814

The thread titled "PATCH: use construct and destroy from user-provided allocators"
http://thread.gmane.org/gmane.comp.gcc.libstdc++.devel/9847

-- 
   Alex Vinokur
     http://mathforum.org/library/view/10978.html
     http://sourceforge.net/users/alexvn


Relevant Pages

  • Re: Speed quirk: redundant line gives six-fold speedup
    ... >> and comparison of objects depends on the state of the memory ... >> allocator. ... I'm also pretty sure I've caught a bug in his code, ... <snip more 4s from the same object> ...
    (comp.lang.python)
  • Re: DEP and /NXCOMPAT troubles...
    ... Setting aside full pages is a complete waste of space. ... If you find yourself generating "a few hundred bytes" often without an opportunity to reuse memory, write your own allocator that takes memory from an executable page heap. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: void pointers
    ... Ben Bacarisse wrote: ... snip ... ... allocator here and I doubt that is programmable in standard C. ...
    (comp.lang.c)
  • Re: void pointers
    ... CBFalconer wrote: ... snip ... ... allocator here and I doubt that is programmable in standard C. ...
    (comp.lang.c)
  • Re: JavaScript, Higher Order Functions, Closures, how come?
    ... var container = document.getElementById; ... ....this closure will form a circular reference involving DOM nodes (container and elt). ...
    (comp.lang.javascript)