Wednesday, 20 August 2008

How to abuse a C++ memory management system

1) Create hell lot of pointers.
2) Use new to allocate memory for half of them
3) Use malloc for rest.
4) Try to use realloc to vary the memory size allocated to pointers in step 2
5) Attempt to use free on pointers in step 3.
6) Result : Every conceivable memory related crash at the run time...

Enjoy

No comments: