I am guessing that the configuration set for memory usage for the driver process is less and the memory required is high. By default, it is set to 1g. Try increasing it.
val sc = new SparkContext(new SparkConf())
./bin/spark-submit <all your existing options> --conf spark.driver.memory=4g