I am trying to add the parameter "-Xmx4096m -XX:PermSize=128m -XX:MaxPermSize=128m" to ambari-env file. If my ambari server is having 16GB of RAM, how much i can give -Xmx?
This is a PermGen space issue. Usually not caused by a memory leak, the permanent generation space is use for class loading, string literals, etc. The amount of RAM on the VM should not really affect your decision on this number.
Instead, give it increments that make sense. Try increasing to 256m as the maximum and see if the problem is resolved. If not, then something else is going on here.
Can you give some background in what you were doing at the time?
Also, you can try switching to JDK 8 which no longer uses permanent generation.