How to increase java memory Ubuntu Server 20.04?

I have installed the monitoring plugin. In the section of memory used by java I see that the maximum is 2gb when my system allows me 4gb.

I have modified the /etc/default/jenkins file but I think that is not the one I should use as it has no effect.
Same with this command. sudo systemctl edit jenkins and added Environment="JAVA_ARGS=-Xmx4g -Djava.awt.headless=true"

Also I modified /etc/init.d/jenkis and set JAVA_ARG but no effect

What is the correct procedure?

My version of jenkins is the last

See the instructions at:

Good values for the various JVM parameters are offered at