Set spark mem using slave memory

Fixes SPARK-701 by using the minimum of master and worker memory for SPARK_MEM