GithubHelp home page GithubHelp logo

Comments (6)

moberemk avatar moberemk commented on May 21, 2024 1

@varsha2409 I've got a PR open, #43, that may address your issues--any chance you could give my fork a go to see if it helps you at all?

from chartjs-node.

sedouard avatar sedouard commented on May 21, 2024

Hey @varsha2409 I would check to see if something is holding on to the chartNode reference.

Often times when you see these kinds of issues it is due to a large object (like chartNode which contains a virtual DOM) that sits high in scope and never gets dereferenced for garbage collection.

from chartjs-node.

varsha2409 avatar varsha2409 commented on May 21, 2024

Hey @sedouard did you find anything?
I analysed the heap dump, there are many ChartElement, Chart.Controller and other Chart related objects.
I even did a force GC after every chart is created, these elements were still present.

from chartjs-node.

sedouard avatar sedouard commented on May 21, 2024

@varsha2409 are you able to copy/paste the full context you're running this library in? I'm interested in seeing how it is repeatedly called. I suspect you are holding on to a references and thats why you're experiencing a leak.

from chartjs-node.

tscritch avatar tscritch commented on May 21, 2024

Hey guys,

I'm still having trouble with this. Calling destroy is not removing the instance of the chartNode.

I am using v1.7.1

Any insight?

return new Promise(function (resolve, reject) {
  var chartNode = new Chart(_options.width, _options.height)

  var options = {...}

  chartNode.drawChart(options)
        .then(() => {
          if (_options.base64) {
            // if base64 was in the query then return base64 data
            return chartNode.getImageDataUrl(_options.type)
          } else {
            // else return the image buffer
            return chartNode.getImageBuffer(_options.type)
            }
        })
        .then(image => {
          resolve(image)
        })
        .finally(() => {
          chart.destroy()
        })
        .catch(error => {
          reject(error)
        })
    })

from chartjs-node.

jacktuck avatar jacktuck commented on May 21, 2024

@tscritch I think u want to be destroying the chart instance in ur finally block? chartNode.destroy ?

from chartjs-node.

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.