Thoughts on malloc()

* Always check for equal number of malloc()/free() calls. • Use calloc() instead of malloc() + memset() • Instead of allocation memory in a piece-meal manner, try to allocate a bigger chunk with malloc() and keep on resizing it with realloc() if needed. • malloc() over-commits the memory i.e. it gives you an address which … More Thoughts on malloc()