Re: C++ Memory Management Innovation: GC Allocator
  Home FAQ Contact Sign in
comp.lang.c++.moderated only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: C++ Memory Management Innovation: GC Allocator         

Group: comp.lang.c++.moderated · Group Profile
Author: xushiwei
Date: Apr 30, 2008 02:20

"Chris Thomasson" comcast.net> wrote:
> Here is a very crude dynamic region allocator I did for C++:
>
> http://groups.google.com/group/comp.lang.c++/browse_frm/thread/68bdc7...

I have a suggestion about your region allocator: Use allocator
instances instead of global new/delete procedures.

I don't like to override the DEFAULT operator new/delete. This makes
your code doesn't work well together 3rdparty code (if it also
override them).

I suggest ISO C++ cancel this feature, just like we can't override
operator+ of all C types. That is:

1. You CAN NOT override these operators:

void* operator new(size_t size);
void operator delete(void* p);

2. You CAN override NON-DEFAULT operator new. Such as:

void* operator new(size_t size, my_allocator& alloc);

3. There is no need to override operator delete. If you need delete
objects in special way, just use:

alloc.destroy(obj);

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
no comments
diggit! del.icio.us! reddit!