chapter8, Placement new

There is a grammar, “placement new”, that creates an instance on an already allocated memory address.

However, not all the contents of the instance need external memory (new), and even that is new, it goes outside. For this reason, we would like to use this only when a new instance is required in situations where wrapped memory allocation functions are required rather than speed.

For example, “OPENSSL_malloc”. When allocating memory here, “new” cannot be used. So, after allocating here, use “placement new”. However, care must be taken to ensure that the objects created here do not use external memory. Also, “placement new” needs to manually call the destructor. It is this for “placement new” that the destructor can be called directly for some reason.

暗号通貨短編