Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/node-v0.x-archive
base: 5fe05464cb4b
Choose a base ref
...
head repository: nodejs/node-v0.x-archive
compare: 6b99fd23237d
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Feb 5, 2013

  1. zlib: reduce memory consumption, release early

    In zlibBuffer(), don't wait for the garbage collector to reclaim the zlib memory
    but release it manually. Reduces memory consumption by a factor of 10 or more
    with some workloads.
    
    Test case:
    
      function f() {
        require('zlib').deflate('xxx', g);
      }
      function g() {
        setTimeout(f, 5);
      }
      f();
    
    Observe RSS memory usage with and without this commit. After 10,000 iterations,
    RSS stabilizes at ~35 MB with this commit. Without, RSS is over 300 MB and keeps
    growing.
    
    Cause: whenever the JS object heap hits the high-water mark, the V8 GC sweeps
    it clean, then tries to grow it in order to avoid more sweeps in the near
    future. Rule of thumb: the bigger the JS heap, the lazier the GC can be.
    
    A side effect of a bigger heap is that objects now live longer. This is harmless
    in general but it affects zlib context objects because those are tied to large
    buffers that live outside the JS heap, on the order of 16K per context object.
    
    Ergo, don't wait for the GC to reclaim the memory - it may take a long time.
    
    Fixes #4172.
    bnoordhuis committed Feb 5, 2013
    Copy the full SHA
    8d14668 View commit details
    Browse the repository at this point in the history
  2. zlib: pass object size hint to V8

    Inform V8 that the zlib context object is tied to a large off-heap buffer.
    
    This makes the GC run more often (in theory) and improves the accuracy of
    --trace_external_memory.
    bnoordhuis committed Feb 5, 2013
    Copy the full SHA
    6b99fd2 View commit details
    Browse the repository at this point in the history