I have a Solr 5.0.0 in production with a custom heap size like this
SOLR_JAVA_MEM="-Xms2g -Xmx2g"
When I tried to migrate to Solr 5.1.0 with the same configuration and start the server it returned a OutOfMemoryError. Looking to the Solr API I saw that the heap size was set to 512m. My custom heap configuration is not working in Solr 5.1.0 and the server is starting with the default heap size value.

It's a bug that occurs just in Solr 5.1. There is an issue resolved that fixed this bug in Solr 5.2.
https://issues.apache.org/jira/browse/SOLR-7454
The problem is that Solr 5.1 doesn't use
SOLR_JAVA_MEMto set heap size. It usesSOLR_HEAPto set the min and max heap sizes with the same value like this:This way solr will start with
-Xms=2gand-Xmx=2gIn Solr 5.2 this bug was fixed and the two
SOLR_JAVA_MEMandSOLR_HEAPwork fine.