Hi,
I override the operator new[](size_t size) in my application and monitor the memory allocation and release.
However, I found a strange thing (environment: CCS5, C28346 evaluation board):
For built-in type (e.g. int,) , size is transferred in operator new[]() is correct.
For no explicit constructor class, the size is also correct for operator new[]().
For "normal" class with constructor, the size is transferred into operator new[]() is: sizeof(Class)*numberOfClass + 4 (why does compiler to insert this extra 4 words?)
e.g.
class SimpleClass
{
public:
SimpleClass(){
}
private:
int i;
};
if new SimpleClass[1], the size in operator new[]() is 5 (4+1) , the MAU is word(16bits).
Looking forward to your response.
Thank you.
Matt