0

There is a c++ code shown below:

Chunk * _chunk = new (size) Chunk(size);

I don't understand the first '(size)' following the 'new',What's the meaning of it? The code above is from JDK8.

yangyixiaof
  • 225
  • 4
  • 15
  • 2
    Find the overloaded `void * operator new(size_t, size_t)`. – timrau Sep 13 '14 at 02:05
  • [What uses are there for “placement new”?](http://stackoverflow.com/q/222557/995714), [What is “placement new” and why would I use it?](https://isocpp.org/wiki/faq/dtors#placement-new) https://en.wikipedia.org/wiki/Placement_syntax http://en.cppreference.com/w/cpp/language/new – phuclv Oct 11 '15 at 04:02

1 Answers1

1

That is called placement new syntax. You might be able to find more about it using the technical name. The arguments you ask about are passed to an overloaded operator new in addition to the normal computed size in bytes.

JDługosz
  • 5,592
  • 3
  • 24
  • 45