How does delete know how many bytes to release?
Members - Reputation: 982
Posted 14 December 2011 - 03:21 AM
Members - Reputation: 133
Members - Reputation: 1959
Posted 14 December 2011 - 08:59 AM
Operator new will call the constructor for an object, whereas malloc will not. You could use malloc and then placement new and get the same effect as if you had just allocated the memory with new (Except you need to free the memory with free() rather than delete, and need to manually call the destructor first).
any differance in new or malloc, besides new->delete and malloc->free() ?
Operator new is usually implemented as a call to malloc() internally.
Senior programmer, Firebrand Games