Skip to content

Calling sizeof uses a lot of heap memory #102

@david-vendel

Description

@david-vendel

We used this library to log the size of objects being cached. However, it actually causes massive memory usage spikes.

To put it in numbers:
Heap size (v8.getHeapStatistics()['used_heap_size']) jumped from 130 MB to 477 MB, while the object being measured was only 27 MB.
That means the library consumed ~347 MB of heap just to calculate the size of a 27 MB object.

Please consider updating your README — especially on the npm page — to warn users about this behavior.

It’s ironic that a library intended to help diagnose memory issues is, in fact, introducing them.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions