memory slop

Simon Marlow marlowsd at
Wed Mar 23 14:32:33 CET 2011

On 22/03/2011 16:47, Brandon Moore wrote:
>> On Tue, March 22, 2011 21:00:29 Tim Docker<twd2 at>  wrote:
>> I'm a bit shocked at the amount of wasted memory here. The sample  data file
>> has ~61k key/value pair. Hence ~122k ByteStrings - as you point  out
>> many of these are very small (1500 of them are empty). Assuming it's the
>> bytestring that are generating slop, I am seeing ~500 bytes on average per
>> bytestring!
> It sounds like the space is allocated but unused pages. Unless you have messed
> with some kernel memory manager settings, unused virtual pages consume no
> physical RAM.
> You could confirm this by using ps to check how much RSS is actually used,
> compared to VSZ allocated (VSZ - RSS shouldn't include any actual data unless
> your system is actively swapping stuff to disk). If it is just unsued pages it's
> not a problem.

GHC never allocates more than 1MB above what it needs at any given time. 
  If the memory usage of the program spikes, then unused pages are 
returned at the next GC.


More information about the Glasgow-haskell-users mailing list