Edit /etc/sysconfig/elasticsearch (RPM) or /etc/default/elasticsearch (DEB) and uncomment the ES_HEAP_SIZE line, and set a value, eg:
# Heap Size (defaults to 256m min, 1g max) ES_HEAP_SIZE=16g