Chunk
A small range of memory that can be allocated (owned by the application), freed (owned by glibc), or combined with adjacent chunks into larger ranges. Note that a chunk is a wrapper around the block of memory that is given to the application.
...
Glibc's malloc is chunk-oriented. .... all chunks are multiples of 8 bytes ...
A chunk has a header (which has the size of he chunk and state flags) in addition to the payload area.
To ne555,
It seems you are right. I think i misunderstood the array of pointer declaration that is the reason i swapped rows and columns. I would like to discuss more about it here:
int (*p)[4];
As per me, p is an array of 4 elements and each element is again a pointer to int. I accessed each element using 'i' index from 0 to 3.
int (*p)[4];
p is a pointer. It points to arrays of 4 elements.
If it easier to understand, consider it like
1 2 3 4 5 6
typedefint array[4];
int main(){
array *p; //a pointer to arrays of 4 elements
p = new array[3]; //dynamically allocate 3 arrays.
}
If you wanted to declare an array of 4 pointers, then int *p[4]; (note the lack of parenthesis)
However, then you need to allocate the memory for each pointer, p[0], p[1], p[2], p[3].