Patches for the allocators (malloc/debug).

Dhruv Matani
Fri Mar 5 10:47:00 GMT 2004


I don't know what the intention was in making malloc_allocator not throw
anything but that makes it non-compliant, and also the user is not
warned about any unsuccessful allocations, So I have added that check.

Also, I have added another check in debug_allocator for checking whether
a NULL pointer was passed.

	-Dhruv Matani.

Proud to be a Vegetarian.
-------------- next part --------------
2004-03-05  Dhruv Matani  <>

	* ext/malloc_allocator.h: Fixed the construct function to call
	global placement new instead of assignment. Added a check after
	the return from malloc to check whether returned pointer is NULL,
	and if so, throw std::bad_alloc().
	* ext/debug_allocator.h: Added a check in the deallocate function
	to check whether the user has passed a NULL pointer or not.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.allocators.dhruv.05032004
Type: text/x-patch
Size: 2676 bytes
Desc: not available
URL: <>

More information about the Libstdc++ mailing list