Git Product home page Git Product logo

Comments (1)

bitwalker avatar bitwalker commented on May 18, 2024

If you can open a PR with a test that reproduces the issue, I can take it from there - if it will be too tricky to get it repro'd in a test, then a standalone app is fine too; the main thing is just that I have a way to do reliably see the same memory behaviour you are seeing.

One thing to keep in mind, especially when working with binaries, is that within the context of a process, binary data will be shared - the original binary which is referenced won't be released until all of the shared references (sub-binaries) are garbage collected, which can take some time if the process isn't particularly active, at least once the heap grows large enough.

You can see if this is the problem by examining the memory allocations in Observer, or dumping them with :erlang.system_info/1, e.g. :erlang.system_info(:allocated_areas). You can do the same at the process level with :erlang.process_info/1, e.g. :erlang.process_info(:binary), the :garbage_collection and :garbage_collection_info flags can be useful as well. What you are looking for is signs that objects are accumulating on the process heap, and garbage collection is not collecting enough in each cycle.

Based on what your snippet indicates, I have a feeling it is probably sub-binary references causing the memory leak - if that's the case there are a couple of strategies for dealing with that. One is using :binary.copy/1 on binary values you are inserting into the graph to force them to not reference the original large binary. If that's not doing it, then explicitly forcing a collection may be necessary - perhaps after remove_vertex_labels is called.

Once you post a repro, we can dig in further :)

from libgraph.

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.