max-mapper / max-mapper/filereader-stream

Memory leak

Open
#14 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
102
Forks
18
PR merge metrics
No merged PRs in 30d

Description

This could be my fault because I don't know anything about javascript but it looks like the chunks don't get garbage collected. I got this far:


var drop = require('drag-and-drop-files')
var concat = require('concat-stream')
var fileReaderStream = require('filereader-stream')
var zlib = require('zlib')

drop(document.body, function(files) {
  var first = files[0]
  console.log("start gzip " + first.name);
  gzip = zlib.createGzip({'level':1})
  gunzip = zlib.createGunzip()
  // fileReaderStream(first).pipe(gzip.pipe(gunzip))
  datin = fileReaderStream(first)
  // datin.setEncoding('utf8')
  datin.pipe(gzip)
  gzip.pipe(gunzip)
  gunzip.setEncoding('utf8')
  var count = 0
  gunzip.on('data', function(chunk) { count = count + chunk.length })
  gunzip.on('finish', function() { console.log("done, got " + count + " bytes") })
})

When I drop a 300MB file on the browser, I watch the memory go up and up. When it's done, there's a bunch of blob:// objects like:

blobs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the browser example with a 300MB dropped file and inspect the gzip/gunzip and fileReaderStream lifecycle while monitoring memory and blob:// objects. Determine whether the stream finishes while retaining chunks or blob URLs; done means the completed operation no longer retains those objects and memory behavior is covered by a reproducible check.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.