In MSVC++, First i created a vil_image_view container(im_1) and allocated the memory by giving the size (rows and columns), then i assigned a NULL value to that pointer, After both these steps i created another image container(im_2) and did the same procedure to allocate the memory and i have noticed that memory addresses of both containers were same. Is that completely random? Or How that allocation and deallocation happens?
vil_image_view is an image container from vxl library and it is a shared pointer, when the reference counter becomes zero, the object will be automatically deleted
vil_image_view<float> im_1;
im_1.set_size(n,m); //0x05773ff0
im_1 = NULL; //0x00000000
vil_image_view<float> im_2;
im_2.set_size(n,m); //0x05773ff0
malloca block of memory, thenfreeit, thenmallocagain with the same size, chances are high you'll get the same block back - it's sitting at the top of the free list