Spark memory layout — why the exception fires
executor Spark memory = (16g − 300MB) × spark.memory.fraction 0.6 = 9.4 GB
driver Spark memory = (8g − 300MB) × 0.6 = 4.6 GB · maxResultSize = 1.0 GB
Driver heap 8.0 GB is not all yours. collect()/toPandas() still have to fit deserialized rows in that JVM. Executor Spark memory is 9.4 GB each and does not take this result.
- Reserved 300MB
- User 40%
- Execution
- Storage / cache
