--- In [email protected], shamir shakir <dewswo...@...> wrote:
>
> So, is there any function to run-time checking here that I can use? 

There isn't anything in the C Standard - I suspect C++ is the same, although 
I'm not a C++ programmer.

Try checking your compiler/IDE documentation - there might be an option that 
adds some sort of checking to the generated code.

> And why did the OS allocated more space ?

The OS might allocate memory in blocks, and the smallest block might be (for 
example) 1k. It might not be the most space efficient algorithm, but it might 
be quicker and simpler than one that allocates exactly the amount you request.

If you are interested, try Googling for 'memory allocation' eg.
http://en.wikipedia.org/wiki/Dynamic_memory_allocation

Reply via email to