Implement a custom memory allocator like malloc and free, and explain how you would prevent memory fragmentation.