Add support for memory limit

Right now it seems the submission will just time out if it tries to
allocate too much memory