allow user define memory allocation function