Adding support for customed memeory allocator

Signed-off-by: Eyal Salomon <esalomon@mellanox.com>