8000 Memory leak exists when using fix_vertices · Issue #31 · kahypar/KaHyPar.jl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Memory leak exists when using fix_vertices #31

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” 8000 , 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

Open
ArrogantGao opened this issue Mar 8, 2025 · 3 comments
Open

Memory leak exists when using fix_vertices #31

ArrogantGao opened this issue Mar 8, 2025 · 3 comments

Comments

@ArrogantGao
Copy link
ArrogantGao commented Mar 8, 2025

I found that there exists a memory leak when using fix_vertices function, in the following MWE, the memory usage of the process will grow monotonically until it is killed.
I use the htop tool to check the memory usage, I would be glad to do more tests if you guys know better way to record the memory usage.

using KaHyPar, Graphs, SparseArrays

function edge2vertex(g::SimpleGraph)
    I = Int[]
    J = Int[]
    edgecount = 0
    @inbounds for i in 1:nv(g)-1, j in g.fadjlist[i]
        if j > i
            edgecount += 1
            push!(I, i)
            push!(I, j)
            push!(J, edgecount)
            push!(J, edgecount)
        end
    end
    return sparse(I, J, ones(length(I)))
end

function select_region(g, i, n)
    h = KaHyPar.HyperGraph(edge2vertex(g))
    imbalance = 1 - 2 * n / nv(g)

    local fix_vs = [j == i ? 1 : -1 for j in 1:nv(g)]
    KaHyPar.fix_vertices(h, 2, fix_vs)
    KaHyPar.set_target_block_weights(h, [nv(g) - n, n])

    parts = KaHyPar.partition(h, 2)
    return findall(!iszero, parts)
end

g = random_regular_graph(1000, 3)

while true
    for i in 1:1000
        select_region(g, i, 15)
    end
end
@YijiawWang
Copy link
YijiawWang commented Mar 8, 2025

I think that this issue might stem from the conflict between functions KaHyPar.fix_vertices and KaHyPar.set_target_block_weights, as the memory leak only occurs when they are used simultaneously.

@ArrogantGao
Copy link
Author
ArrogantGao commented Mar 8, 2025

I think that this issue might stem from the conflict between functions KaHyPar.fix_vertices and KaHyPar.set_target_block_weights, as the memory leak only occurs when they are used simultaneously.

I don't think so, actually I obseved that solely using fix_vertices will cause memory leak.

@SebastianSchlag
Copy link
Member

Thanks for reporting this. @jalving do you have any idea what could be going wrong?

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

3 participants
0