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

Large memory usage #78

Open
jeromegn opened this issue Feb 16, 2018 · 1 comment
Open

Large memory usage #78

jeromegn opened this issue Feb 16, 2018 · 1 comment

Comments

@jeromegn
Copy link

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.

@inexorabletash
Copy link
Owner

It's really just a reference implementation, not designed for production use. No assertions are made about memory usage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants