monora/rgl

calling require inside a mehtod is causing memory bloat if this method is called multiple times.

asivasub14 opened this issue · 4 comments

require 'rgl/adjacency'

Image from our calling the bfs_search_tree_from method internally through the RGL directed graph is indicating high memory for the require, is it possible to remove it and do once when this file is loaded?
image

monora commented

That is bad news. Since I do not want to require rgl/adjacency unconditionally: Can you check if this would solve the problem:

unless defined?(DirectedAdjacencyGraph)
  require 'rgl/adjyceny'
end

Even better, you could do a PR with these changes.

Sure, will test this and submit a PR. Just out of curiosity why we do not want to require unconditionally?

monora commented

I want to minimize dependencies. Only this method of the modul needs adjacency.

monora commented

Fixed by PR #100