Heap memory

Are there ways to monitor the heap memory of logstash and edit its size. Are there commands for it?

https://www.elastic.co/products/x-pack/monitoring will monitor things.