Changing memory allocation methods for no-throw guarantee.

Operator new throws a bad_alloc exception when there is not enough memory
to allocate the object. Instead we'll allocate with malloc (or calloc),
and throw an internal exception if the allocation returns NULL. Then,
placeable new will be used to construct the objects at the allocated
memory.