This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thoughts on memory allocation...


Hi, Stefan.  I won't have time to look over the code tonight, but I have
some quick comments after reading the message.

> redundant to what others have done so many times so I made a few design 
> decisions:
> 
> - Try to do as few system (i.e. malloc) calls as possible to gain 
> similar performance across various platforms.
> 
> - Since most of our applications are long running ones (application 
> servers and such) keep the heap growth (due to fragmentation etc) to a 
> minimum.
> 
> - Don't bother about memory consumption if needed to accomplish the 
> previous task (I don't like to waste memory, but on the targets that we 
> are working on memory is not that much of an issue).

All good ideas; these were the same goals of __default_alloc_template.


> discussion...) and then tell the containers to use this by wrapping it 
> through the __allocator<> adapter available in stl_alloc.h (i.e. vector< 
> int, __allocator< void, nn4us::nn4us_alloc > > foo;)
                    ^^^^
                    This should be int.


> - There seems to something "missing" in the __allocator<> code since I 
> had to add the operator == and != in order to get basic_string<> to 
> compile, this does however not happen if I try to compile with 
> malloc_allocator which is part of stl_alloc.h - why I don't know...

Which version of the libstdc++ sources are you using?  There's nothing
called malloc_allocator (unless you meant __malloc_alloc_template).
The operators for __allocator are template functions, defined around line
800 of stl_alloc.h in current sources.


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]