Does the C ++ standard define a new malloc for use?
The C ++ standard (which means the standard document that defines the C ++ language) does not define operator new in terms of malloc() . However, it is likely that in most implementations of the C ++ standard library, malloc() used to allocate memory.
In paragraph 18.6.1.1/4 of the C ++ 11 standard (near operator new ):
Default behavior
- Loops: inside the loop, the function first tries to allocate the requested storage. If the attempt involves a function call to the standard C
malloc , it is not specified .
source share