c:\test>p1 [0] Perl> system qq[tasklist /fi "PID eq $$"];; Image Name PID Session Name Session# Mem Usage ========================= ====== ================ ======== ============ perl.exe 888 0 2,972 K [0] Perl> open RAM, '>', \$ram;; [Bad file descriptor] Perl> print RAM 'X' x 1e6 for 1 .. 100; print length $ram;; 100000100 [0] Perl> system qq[tasklist /fi "PID eq $$"];; Image Name PID Session Name Session# Mem Usage ========================= ====== ================ ======== ============ perl.exe 888 0 101,008 K [0] Perl> close RAM;; [0] Perl> undef $ram;; [0] Perl> system qq[tasklist /fi "PID eq $$"];; Image Name PID Session Name Session# Mem Usage ========================= ====== ================ ======== ============ perl.exe 888 0 3,256 K #### VMem::~VMem(void) { #ifndef _USE_BUDDY_BLOCKS ASSERT(HeapValidate(m_hHeap, HEAP_NO_SERIALIZE, NULL)); #endif WALKHEAPTRACE(); DeleteCriticalSection(&m_cs); #ifdef _USE_BUDDY_BLOCKS for(int index = 0; index < m_nHeaps; ++index) { VirtualFree(m_heaps[index].base, 0, MEM_RELEASE); <<<<<<<<< HERE! } #else /* !_USE_BUDDY_BLOCKS */ #ifdef USE_BIGBLOCK_ALLOC for(int index = 0; index < m_nHeaps; ++index) { if (m_heaps[index].bBigBlock) { VirtualFree(m_heaps[index].base, 0, MEM_RELEASE); <<<<< HERE! } } #endif BOOL bRet = HeapDestroy(m_hHeap); ASSERT(bRet); #endif /* _USE_BUDDY_BLOCKS */ } void VMem::ReInit(void) { for(int index = 0; index < m_nHeaps; ++index) { #ifdef _USE_BUDDY_BLOCKS VirtualFree(m_heaps[index].base, 0, MEM_RELEASE); <<<<<< HERE! #else #ifdef USE_BIGBLOCK_ALLOC if (m_heaps[index].bBigBlock) { VirtualFree(m_heaps[index].base, 0, MEM_RELEASE); <<<<< HERE! } else #endif HeapFree(m_hHeap, HEAP_NO_SERIALIZE, m_heaps[index].base); #endif /* _USE_BUDDY_BLOCKS */ } Init(); }