What does the C++ new operator do other than allocation and a ctor call?

前端 未结 3 1112
傲寒
傲寒 2020-12-06 02:30

What are all the other things the new operator does other than allocating memory and calling a constructor?

3条回答
  •  独厮守ぢ
    2020-12-06 03:19

    Depends on if it's overloaded or not, if you built the app for debugging, if you're using a memory leak detector, if you have some kind of memory pooling scheme, if you have something like the Boehm garbage collector that's marking/unmarking bits, etc., etc. It could be doing a lot of custom stuff inside, or nothing special at all.

提交回复
热议问题