回复: about libstdc++ ,change the defaule allocator

Jiandong Lu lujiandong1001 at yahoo.com.cn
Wed Jan 20 00:51:56 UTC 2010


Thanks




________________________________
发件人: Xin LI <delphij at gmail.com>
收件人: Jiandong Lu <lujiandong1001 at yahoo.com.cn>
抄   送: freebsd-hackers at freebsd.org
发送日期: 2010/1/15 (周五) 2:54:42 上午
主   题: Re: about libstdc++ ,change the defaule allocator

2010/1/13 Jiandong Lu <lujiandong1001 at yahoo.com.cn>:
> hello,everyone.
> 聽 聽 I get the current source code from svn,and successfully build world.
> 聽 聽 c++'s standard library is from gnu. This library privodes many allocators:
> bitmap_allocator_base
> malloc_allocator_base
> mt_allocator_base
> new_allocator_base
> pool_allocator_base
> I want to know how to set a default allocator,and how to change it.
>
> I have read the Makefile:
> /usr/src/gnu/lib/libstdc++/Makefile

I have no idea why you will think the allocator is being changed here...

The standard and portable way to override the allocator is at the
point you instance C++ templates by specifing Allocator parameter.
If, however, you want to globally change the default allocator without
touching all your source files, the only way is to make modification
on c++allocator.h, which is, in my opinion, never permitted by the
standard and banned by god.

Cheers,
-- 
Xin LI <delphij at delphij.net> http://www.delphij.net



      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/


More information about the freebsd-hackers mailing list