< prev index next >

src/hotspot/share/memory/metaspace/freeBlocks.cpp

Print this page
*** 28,34 ***
  #include "utilities/debug.hpp"
  #include "utilities/globalDefinitions.hpp"
  
  namespace metaspace {
  
! void FreeBlocks::add_block(MetaWord* p, size_t word_size) {
!   if (word_size > MaxSmallBlocksWordSize) {
!     _tree.add_block(p, word_size);
    } else {
!     _small_blocks.add_block(p, word_size);
    }
  }
  
! MetaWord* FreeBlocks::remove_block(size_t requested_word_size) {
    size_t real_size = 0;
!   MetaWord* p = nullptr;
!   if (requested_word_size > MaxSmallBlocksWordSize) {
!     p = _tree.remove_block(requested_word_size, &real_size);
    } else {
!     p = _small_blocks.remove_block(requested_word_size, &real_size);
    }
!   if (p != nullptr) {
-     // Blocks which are larger than a certain threshold are split and
-     //  the remainder is handed back to the manager.
-     const size_t waste = real_size - requested_word_size;
-     if (waste >= MinWordSize) {
-       add_block(p + requested_word_size, waste);
-     }
-   }
-   return p;
  }
  
  } // namespace metaspace
- 
--- 28,25 ---
  #include "utilities/debug.hpp"
  #include "utilities/globalDefinitions.hpp"
  
  namespace metaspace {
  
! void FreeBlocks::add_block(MetaBlock bl) {
!   if (bl.word_size() > _small_blocks.MaxWordSize) {
!     _tree.add_block(bl);
    } else {
!     _small_blocks.add_block(bl);
    }
  }
  
! MetaBlock FreeBlocks::remove_block(size_t requested_word_size) {
    size_t real_size = 0;
!   MetaBlock bl;
!   if (requested_word_size > _small_blocks.MaxWordSize) {
!     bl = _tree.remove_block(requested_word_size);
    } else {
!     bl = _small_blocks.remove_block(requested_word_size);
    }
!   return bl;
  }
  
  } // namespace metaspace
< prev index next >