JuliaGraphs / JuliaGraphs/GraphViz.jl

Memory leak?

Open
#42 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
69
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Hi,

when running a simple script like this:

using GraphViz
using FileIO

function foo()
    g = dot"""
      digraph graphname {
        a -> b -> c;
        b -> d;
      }
    """
    FileIO.save("graph.svg", g)

    GraphViz.free(g)  # This should be called as a finalizer, but let's be explicit
    nothing
end

for i in 1:1000
    i % 10 == 0 && println(i)
    foo()
    GC.gc()
end

# It's convenient to wait in the end; this makes it easy to check the final
# memory consumption with something like `top`
println("Done. Press ^C to abort")
sleep(3600)

one can readily see with a tool like top that the memory consumption of the Julia process slowly but surely increases. On my system, resident memory is around 275Mb for the first few iterations, and increases to around 305Mb after the 1000th.

Explicitly calling free does not seem to change anything, so it would look like the issue is more subtle than a finalizer not being called.

Is that an issue with my code? Or is there a memory leak somewhere? (And in the latter case, do you think it is an upstream issue or an issue with GraphViz.jl?)

Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the provided Julia script with GraphViz and FileIO, monitoring resident memory with top while retaining the explicit GraphViz.free(g) and GC.gc() calls. Compare the growth across iterations and determine whether the retained memory belongs to Julia, GraphViz, or GraphViz.jl. Done means identifying the leak boundary and documenting or fixing the responsible behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.