Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop V8::AdjustAmountOfExternalAllocatedMemory usage unless it helps perf #136

Closed
springmeyer opened this issue Feb 13, 2013 · 1 comment
Milestone

Comments

@springmeyer
Copy link
Member

We give V8 memory hints with V8::AdjustAmountOfExternalAllocatedMemory, but because this function has to be called from the main loop, and because calling it is not always cheap, it may not be worth it. We don't have hard evidence that telling v8 about memory usage outside its heap actually prevents meltdowns/over mem usage, it is just precautionary.

Also, if we remove these calls, then we also don't need to do anything about #119

@springmeyer
Copy link
Member Author

Going to remove this finally. My reasoning is:

  • mapnik.Image objects should be created and destroyed quickly so telling v8 about it is likely unneeded overhead except in memory constrained situations. However memory constrained situations are not common for mapnik rendering
  • over time I've watched bugs come and go with usage of V8::AdjustAmountOfExternalAllocatedMemory in node and v8 like nodejs/node@ff74931 and Buffer and ArrayBuffer-based objects trigger mark-sweeps instead of scavenges nodejs/node#1671 and armv6 performance regression nodejs/node#1188 (comment) and indutny/io.js@5bd62bc. These indicate that for objects in core using V8::AdjustAmountOfExternalAllocatedMemory can be critical for keeping memory low. But also that its hard to get this right. Again, because mapnik images should be created and destroyed pretty quickly I don't think it is worth doing this anymore.
  • If we do find a benchmark/testcase to demonstrate it helps and we choose to re-instate V8::AdjustAmountOfExternalAllocatedMemory usage then we should also do it for mapnik.VectorTile...

@springmeyer springmeyer added this to the v3.5.0 milestone Jul 7, 2015
@springmeyer springmeyer modified the milestones: v3.4.1, v3.5.0 Jul 31, 2015
benjamn added a commit to meteor/node-fibers that referenced this issue Dec 30, 2019
Apparently calling v8::Isolate::AdjustAmountOfExternalAllocatedMemory
frequently results in lots of wasted CPU cycles on garbage collection, per
discussion here: meteor/meteor#10527 (comment)

This fix was inspired by marudor/libxmljs2#22,
which seems to have addressed nodejs/node#30995.

Another project that benefitted from adjusting external allocated memory
less often: mapnik/node-mapnik#136
benjamn pushed a commit to meteor/meteor that referenced this issue Dec 30, 2019
Apparently calling v8::Isolate::AdjustAmountOfExternalAllocatedMemory
frequently results in lots of wasted CPU cycles on garbage collection, per
discussion here: #10527 (comment)

This fix was inspired by marudor/libxmljs2#22, which seems to have
addressed nodejs/node#30995.

Another project that benefitted from adjusting external allocated memory
less often: mapnik/node-mapnik#136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant