Allow override of max memory

Change-Id: I51cb1aa41a9c73026e8d05b9d2100ac37aa7b4c9