Determination of argument passed to operator new

Nikolaus Dunn nikdunn1979@gmail.com
Fri Oct 14 17:26:00 GMT 2016


Hi all,

According to what I've read, the "new" and "new []" expressions are 
implemented by the compiler to compute the size of the storage required 
by the type and then make a call to one of the "new" operators to 
allocate memory and handle construction. I've found the code for the 
"new" operators in gcc, but I can't find where in the gcc code the 
compiler determines the value to be passed to the new operator and then 
sets up the actual call.

The reason I'm asking is I am interested in how the compiler implements 
the "new []" expression. In particular, how it is storing the array size 
and is there any extra overhead being stored and what it is, if any.

I'm assuming it is the actual parser/code generator that is doing this 
since they are unique expressions and not simply function calls. Can 
someone point me to where this code is being generated or correct my 
ignorance if I am way off base?

Thanks,

Nik



More information about the Gcc-help mailing list