Code Monkey home page Code Monkey logo

Comments (7)

yhahn avatar yhahn commented on August 16, 2024

Awesome, I've been pushing on more ported js code here https://github.com/mapbox/carmen-cache/tree/spatialmatch if you want to keep being my guardian angel : )

from carmen-cache.

yhahn avatar yhahn commented on August 16, 2024

@springmeyer if you have a chance tonight would love your gut reaction to the memleak going on in spatialmatch-memtest branch:

https://github.com/mapbox/carmen-cache/blob/spatialmatch-memtest/test/spatialMatch.test.js

I'm probably doing something n00bishly horrible : (

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

@yhahn - does not look like a memory leak. I see the constant growth of memory until the test ends, however it looks like its just because garbage collection is not kicking in. I have this hunch because memory stays constant for me at ~180 MB if I do:

node --expose-gc ./node_modules/.bin/tape test/spatialMatch.test.js

With:

diff --git a/test/spatialMatch.test.js b/test/spatialMatch.test.js
index f5222e7..b682e80 100644
--- a/test/spatialMatch.test.js
+++ b/test/spatialMatch.test.js
@@ -22,6 +22,7 @@ for (var i = 0; i < 10000; i++) test('unit ' + i, function(assert) {
     var args = require('./fixtures/spatialMatch-args.json');
     spatialMatch(args[0], args[1], args[2], args[3], function(err, ret) {
         firstRun = firstRun || process.memoryUsage();
+        gc();
         assert.ifError(err);
         assert.deepEqual(ret, require('./fixtures/spatialMatch-ret.json'));
         assert.end();

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

So, we may need to start using NanAdjustExternalMemory (which calls out to v8::AdjustAmountOfExternalAllocatedMemory) to give V8 a hint that carmen-cache is using memory so that garbage collection is triggered more often.

from carmen-cache.

yhahn avatar yhahn commented on August 16, 2024

Hrm, seeing in actual testcases that gc is not making a difference -- cache definitely seems to be eating more memory and getting progressively slower for the same operations.

Will dig a bit more.

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

Hmm, okay, so must be something else going on that the simple testcase did not cover?

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

capturing chat: we found the mini-memleak: 376c994

from carmen-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.