Andrei Karpuszonak
Andrei Karpuszonak
OK, the difference is coming from here https://github.com/miktam/sizeof/blob/master/indexv2.js#L88 Node.js uses precise string calculation. Here is the PR https://github.com/miktam/sizeof/pull/80 The browser uses quite a simplistic approach, assuming that every string char...
@Marius-Romanus thank you for the investigation! browser-based implementation seems useful, I added it here https://github.com/miktam/sizeof/pull/83 Regarding node.js version, compatibility might be the issue, as you rightfully noted. the current implementation...
ok, latest PR works in node v12, but does not work in v10. Let´s see if this is the best we can have.
Try increasing the heap memory available to your app by using the --max-old-space-size flag, like `node --max-old-space-size=4096 yourScript.js`. The value (4096) is in megabytes.
@RezaAb, thank you for the update! Heavily nested arrays will cause the module to throw, as the engine can not allocate memory for a huge data structure with the nested...
from the perspective of a person who wants to get an estimated size in Bytes - I would not count it twice, by maybe would count only a reference. but...
Fixed here https://github.com/miktam/sizeof/pull/76
@tufandevrim currently module will not calculate both cases correctly. I will add it in the next version. Thanks for suggestion
fixed here https://github.com/miktam/sizeof/pull/76