memory limit crash

i have crashes on some not so bid data files with shutdown function.
MacOS 10.9.3, PHP 5.4.24
i fix crashes with changing one line to this 
ini_set('memory_limit', (memory_get_usage(true)/1024/1024+5)."M"); // if memory limit exceeded
seems like ini_set('memory_limit' does not accept integer value in bites, so i send string with M in the end.