Dot makes PSGraph fail with an `Out of memory` exception
Synopsis
I have programmed a PowerShell function that can analyze a PowerShell module and put out a callgraph over the module. PSGraph is used to generate the graph based on the data retrieved from the module analysis.
The error
When I use Out-PSModuleCallGraph to analyze the code of HealOps I get the following error:
Error: trouble in init_rank
%0 19
%0 10
%0 5
%0 6
%0 23
......
- the list of [%NUMBER NUMBER] is long, so shortened in the above. For the value of info, allow me to mention that commands from the module is mentioned in the list. The error message continues with:
%0 2
%0 1
libpath/shortest.c:324: triangulation failed
libpath/shortest.c:192: source point not in any triangle
Error: in routesplines, Pshortestpath failed
dot(82295,0x7fff9a9c9380) malloc: *** mach_vm_map(size=18446744069337296896) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
out of memory
Export-PSGraph : System error.
At /gitRepos/PowerShellTooling/Public/PowerShellInfo/Out-PSModuleCallGraph.ps1:473 char:22
+ $graphData | Export-PSGraph -ShowGraph
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], ParseException
+ FullyQualifiedErrorId : System.Management.Automation.ParseException,Export-PSGraph
For other modules this error is not thrown. E.g for modules like Plaster or Pester.
Tried
I tried searching for suggestions on the reason behind the error. Some mentions an issue with a circular reference. Others suggests setting max_depth or newrank=true but that draws a graph that does not quite have the layout I would like. However, a graph is actually drawn.
I also tried setting cluster as the name for the subgraph used. This also makes generating the graph go thrugh, however, again not with the layout I would like.
Reproducing
- Clone HealOps from the linke to the repo.
- Download the release of PowerShellTooling
- Import the PowerShellTooling module or dot-source directly to the Out-PSModuleCallGraph.ps1 file.
- Execute Out-PSModuleCallGraph and point it to the HealOps module root. E.g. >
Out-PSModuleCallGraph -ModuleRoot "PATH_TO_HEALOPS_MODULE_ROOT"/HealOps - The same error I describe above should be thrown.
End notes
It would be great if it was possible to generate a graph over HealOps and modules like it (having the same issue) without the error being thrown. See the attached screenshot for an example of the layout I'm tryng to produce. The screenshot if from analyzing another module I'm working on.
Thank you so much for your time.

I think this one can be closed for now. I cleaned up my code, fixed some errors. The modules, like Pester and my own can now be analyzed with my Out-PSModuleCallGraph function.