I had this working before :
echo ini_get(\"memory_limit\").\"\\n\"; ini_set(\"memory_limit\",\"256M\"); echo ini_get(\"memory_limit\").\"\\n\";
If you have the suhosin extension enabled, it can prevent scripts from setting the memory limit beyond what it started with or some defined cap.
http://www.hardened-php.net/suhosin/configuration.html#suhosin.memory_limit