ElasticSearch 7.2.0 immediately fails with Java out of memory error

Java version 1.8.0_221
32 Gigs of memory on machine

If we choose anything over 2048m for the heap size ( like 4096m in the attached screenshot ) elastic search dies IMMEDIATELY upon launch.

The memory shows as only 20% utilized.

If we run it with a small heap, like 2048m, it fails eventually, but sometimes can run for a while.

memory-error

Please don't post images of text as they are hardly readable and not searchable. Instead paste the text and format it with </> icon. Check the preview window.

Could you please provide your jvm options file as text? The error you are receiving is not due to max heap size, but instead due to direct memory. Elasticsearch automatically tries to choose a direct memory size based on several factors, but seeing the entire jvm.options will help determine what is happening.