Skip to content
Snippets Groups Projects
Commit 6fb57ef5 authored by Simon Marlow's avatar Simon Marlow
Browse files

in hClose, free the handle buffer by replacing it with an empty one

This helps reduce the memory requirements for a closed but unfinalised
Handle.
parent 4dfc4d2d
No related branches found
No related tags found
No related merge requests found
......@@ -1158,6 +1158,7 @@ hClose_handle_ handle_ = do
-- free the spare buffers
writeIORef (haBuffers handle_) BufferListNil
writeIORef (haBuffer handle_) noBuffer
#ifndef mingw32_HOST_OS
-- unlock it
......@@ -1170,6 +1171,9 @@ hClose_handle_ handle_ = do
haType = ClosedHandle
})
{-# NOINLINE noBuffer #-}
noBuffer = unsafePerformIO $ allocateBuffer 1 ReadBuffer
-----------------------------------------------------------------------------
-- Detecting and changing the size of a file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment