Difference between global non-throwing ::operator new and std::malloc

The main differences, aside from syntax and free vs. delete, are

  1. you can portably replace ::operator new;
  2. malloc comes with realloc, for which new has no equivalent;
  3. new has the concept of a new_handler, for which there is no malloc equivalent.

(Replacing malloc opens up a can of worms. It can be done, but not portably, because it requires knowledge of the linker.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)