This error comes when your java heap space is fully occupied so now you have to increase the heap allocation for JMeter.
Its very easy , You just have to follow these 2 steps :
1. There is a file in JMeter folder called jmeter.bat or jmeter.sh which is used to run jmeter, now you have to just use a parameter while launching jmeter . also you can change this parameter by editing this file.
JVM_ARGS="-Xms512m -Xmx512m" jmeter.sh
You can change this parameter as per your RAM, here it is 512m of your ram. you should use only 80% of your ram capacity.
2. The other thing to reduce this error is your script listeners they consume a good amount of memory so remove all listeners.
Now try with more users you won't get this error.