S
Sulsa
Does memory allocated by opperator new has gaps, or is it one big block
of memory??
of memory??
Sulsa said:Does memory allocated by opperator new has gaps, or is it one big block
of memory??
Gianni said:One contiguous block.
Phlip said:One contiguous block.
However, C++ often pads data structures such that each aligns to some
boundary of addresses. So, this assertion is well-formed, but is it always
true?
Foo * pFoo = new Foo[15];
assert(reinterpret_cast<char*>(pFoo) + sizeof *pFoo ==
reinterpret_cast<char*>(&pFoo[1])
Does memory allocated by opperator new has gaps, or is it one big block
of memory??
Richard said:It can be addressed as one contiguous block.
An operating system like Windows, which is capable of increasing your
apparent memory by plonking some of it onto the hard disk, might
actually create 'gaps' in your allocated memory, but that's transparent
to your program.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.