added memory allocation method for kernel