Original Post
Hi all, I am new to this forum, so I am not sure if I am posting my question to the right place, but anyway ... Here is my code that gives me the error : "Debug Assertion Failed! Expression BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { int *intPtr = new int[10]; for (int x=0;x<10;x++) { *intPtr = x; intPtr++; } delete [] intPtr; // This line causes the error. return 0; } Is it happening because I increment the Pointer variable ? If this is the cause, how can I free the memory used by a pointer in such a case like this? Thank you for reading my complete newbie and boring question :) And one more question, when I declare an array of 10 integers with the new keyword, is it placed is stack or the heap ? And what determines the size of available stack and heap memory for an application ? I guess memory leaks cause consuming of all available space in heap memory only ? And one more question which memory is faster, and why ? Thanks again.. _EpcH_