我遇到了以下法典:
class a {
public:
void * operator new(size_t l, int nb);
double values;
};
void *a::operator new (size_t l,int n)
{
return new char[l+ (n>1 ? n - 1 : 0)*sizeof(double)];
}
从我获得的东西来看,这种结构从“价值”开始:
double* Val = &(p->a->values) + fColumnNumber;
My question is : is there a memory leak? I am very new to overloading new operator, but I m pretty sure that the memory allocated is not deallocated properly. Also does that mean I can never create a "a" class on the stack?
感谢