It seems that while writing a template dynamic array class..I attemp to use malloc to initialize the array and when I free it I always get a block error.

It is as simple as:

//BLOCK ERROR
T *m_Pool;
m_Pool = (T*)malloc(uiSize);
free(m_Pool);


//WORKS FINE
T* m_Pool;
m_Pool = new T[uiSize];
delete [] m_Pool;




Edit: I am not multiplying the uiSize by the size in bytes -- malloc needs that. My fault.