Hello,
Please run the included sample using PHP CLI mode and update the topic if it works.
Maybe you need to restart the web server to apply the memory changes? If you still see the same exhausted memory size, is because the new setting is not being applied properly.
Regards.