@2ir
I doubt it is related to Java version being used. Of course we would always recommend using the latest update version for a NiFi supported Java version.
As far as using G1GC, it is commented out because Java 8 has many issues when using G1GC and the Java community decided to address those bugs and improvements in Java 9+ versions. Since you are using Java 11, G1GC would be a better option. With that lin commented out, NiFi does not specify and GC for yoru Java and whatever the Default GC defined within your java release would be used. That line allows you to override yoru java default and specify the GC you want to use.
Memory issues are often attributed to issues in custom components added to the NiFi deployment or dataflow design choices. Hence all the dataflow related input i provided previously. You never mentioned if you were encountering any out of memory (OOM) error logs in your NiFi logs? If not, do you see any OOMs if you decrease your Heap memory setting which you have set rather high already. Also recommend setting both xms and xmx to same value.
If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt