SongYadong commented on issue #23426: [CORE][MINOR] Let acquireUnrollMemory 
fail fast if required space exceeds memory limit
URL: https://github.com/apache/spark/pull/23426#issuecomment-451037622
 
 
   Yes, it will fail the allocation in `acquireMemory `anyway, and before that 
`evictBlocksToFreeSpace `is called. 
   In `acquireUnrollMemory`, if `numBytes `is given a very big value(maybe not 
careful), `numBytesToFree `will reach `maxNumBytesToFree `value, making 
`evictBlocksToFreeSpace `evict many cached blocks. 
   
   ```
   def acquireMemory(
         blockId: BlockId,
         numBytesToAcquire: Long,
         numBytesToFree: Long): Boolean = lock.synchronized {
       assert(numBytesToAcquire >= 0)
       assert(numBytesToFree >= 0)
       assert(memoryUsed <= poolSize)
       if (numBytesToFree > 0) {
         memoryStore.evictBlocksToFreeSpace(Some(blockId), numBytesToFree, 
memoryMode)
       }
   ```
   
   
   Failing fast may avoid this situation. @srowen 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to