My ubuntu 16gb ram machine getting stuck after starting elasticsearch

My ubuntu 16gb ram machine getting stuck after starting elasticsearch

I have seen this in google when checking for it and i have added

in /etc/elasticsearch/jvm.options.d/
in that folder i have created one file with jvm.options and added this lines
-Xms4g
-Xmx4g

After adding this also same thing is happening. Machine is getting stuck.

What do you mean by this?

machine is not responding,
when i search in google, i have seen some documentation related to this.
-Xms4g
-Xmx4g
If we add this code, it limits the elasticsearch to use 4gb of ram. but it is not working.