[v3] Mt_alloc: use __bin._M_free[0]

Dhruv Matani dhruvbird@gmx.net
Mon May 17 16:41:00 GMT 2004


Patch for the mt_allocator.h file.

This patch modifies the allocate() function.

Tested x86-Linux.


On Mon, 2004-05-17 at 01:27, Paolo Carlini wrote:
> Dhruv Matani wrote:
> 
> >Ok, maybe the 2nd one will have these, but just in case.
> >  
> >
> No, the 2nd one deals with another, completely unrelated issue.
> 
> >Looking at this part of the code, you could make the operation 
> >O(1), if the number of free blocks in the global free list is <= 
> >those required. Just reset the pointer to NULL for the global 
> >list, and set the next pointer of the current free list to the 
> >one of the global free list's old value.
> >  
> >
> I see what you mean: nice idea. Are you willing to prepare and test
> a patch implementing this?
> 
> Thanks,
> Paolo.
-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.mt_alloc.17052004.diff
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040517/9043bd75/attachment.bin>
-------------- next part --------------
2004-05-17  Dhruv Matani  <dhruvbird@gmx.net>

	* include/ext/mt_allocator.h:(__mt_alloc::allocate)-> Re-write
	allocation loop which removes blocks from the global free list
	from O(N) to O(1) when the required blocks are <= the number
	available.
	


More information about the Libstdc++ mailing list