add exception process for memory allocate failed