Skip to content
This repository was archived by the owner on Sep 28, 2018. It is now read-only.

Large memory usage #78

@jeromegn

Description

@jeromegn

We've noticed the heap goes way up when decoding large array buffers (uint8array) into a utf-8 string.

We're using text-encoding in @fly/fly (a way to run Service Worker-like code in v8 to handle http requests) and it's a life saver. Re-implementing all that logic would've been a pain.

Decoding a ~1.5MB array buffer into a UTF-8 string brings the heap up ~60MB in v8.

More precisely, I'm doing:

  • a fetch to a resource weighing in at 1.5MB
  • concatenating it to a single Uint8Array
  • decoding it with this package

This happens around here: https://github.com/superfly/fly/blob/master/v8env/body.js#L53-L59

I'm measuring heap before and after the decoding and that's when the huge increase of memory seems happens.

Maybe this is normal, I'm not sure. It seems off to me that it would consume so much memory. In any case, I'd love to know more about the expected memory usage of this package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions