In the Knox <knox-home>/bin/gateway.sh file (e.g. /usr/hdp/current/knox-server/bin/gateway.sh) you will find a variable that can be populated with JVM memory settings.
APP_MEM_OPTS=""
For example, you could provide the values show below for an initial and max 2GB heap. Knox will need to be restarted for this to take effect.
APP_MEM_OPTS="-Xms2g -Xmx2g"