Added option for setting the memory limit (default 128MB)