Add ability to use custom memory management functions