Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9000#discussion_r41554990
  
    --- Diff: core/src/main/scala/org/apache/spark/StaticMemoryManager.scala ---
    @@ -0,0 +1,229 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark
    +
    +import scala.collection.mutable
    +
    +import org.apache.spark.storage.{BlockId, BlockStatus, MemoryStore}
    +
    +
    +/**
    + * A [[MemoryManager]] that statically partitions the heap space into 
disjoint regions.
    + *
    + * The sizes of the execution and storage regions are determined through
    + * `spark.shuffle.memoryFraction` and `spark.storage.memoryFraction` 
respectively. The two
    + * regions are cleanly separated such that neither usage can borrow memory 
from the other.
    + */
    +private[spark] class StaticMemoryManager(
    +    conf: SparkConf,
    +    override val maxExecutionMemory: Long,
    +    override val maxStorageMemory: Long)
    +  extends MemoryManager with Logging {
    +
    +  // Max number of bytes worth of blocks to evict when unrolling
    +  private val maxMemoryToEvictForUnroll: Long = {
    +    (maxStorageMemory * conf.getDouble("spark.storage.unrollFraction", 
0.2)).toLong
    +  }
    +
    +  // Amount of execution memory in use. Accesses must be synchronized on 
`executionLock`.
    +  private var _executionMemoryUsed: Long = 0
    +  private val executionLock = new Object
    +
    +  // Amount of storage memory in use. Accesses must be synchronized on 
`storageLock`.
    +  private var _storageMemoryUsed: Long = 0
    +  private val storageLock = new Object
    +
    +  // The memory store used to evict cached blocks
    +  private var _memoryStore: MemoryStore = _
    +  private def memoryStore: MemoryStore = {
    +    if (_memoryStore == null) {
    +      _memoryStore = SparkEnv.get.blockManager.memoryStore
    +    }
    +    _memoryStore
    +  }
    +
    +  // For testing only
    +  def setMemoryStore(store: MemoryStore): Unit = {
    --- End diff --
    
    initialization order :(


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to