Esempio n. 1
0
void
TR::DebugSegmentProvider::release(TR::MemorySegment &segment) throw()
   {
#if defined(LINUX) || defined(__APPLE__) || defined(_AIX)
   void * remap = mmap(segment.base(), segment.size(), PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
   TR_ASSERT(remap == segment.base(), "Remapping of memory failed!");
#elif defined(_WIN32)
   VirtualFree(segment.base(), segment.size(), MEM_DECOMMIT);
   VirtualAlloc(segment.base(), segment.size(), MEM_COMMIT, PAGE_NOACCESS);
#else
   memset(segment.base(), 0xEF, segment.size());
#endif
   }
Esempio n. 2
0
void
OMR::SystemSegmentProvider::release(TR::MemorySegment &segment) throw()
   {
   auto it = _segments.find(segment);
   _rawAllocator.deallocate(segment.base());
   _currentBytesAllocated -= segment.size();
   TR_ASSERT(it != _segments.end(), "Segment lookup should never fail");
   _segments.erase(it);
   }
Esempio n. 3
0
void
TR::SegmentPool::release(TR::MemorySegment &segment) throw()
   {
   if (
      segment.size() == defaultSegmentSize()
      && _storedSegments < _poolSize
      )
      {
      try
         {
         _segmentStack.push(TR::ref(segment));
         ++_storedSegments;
         }
      catch (...)
         {
         _backingProvider.release(segment);
         }
      }
   else
      {
      _backingProvider.release(segment);
      }
   }