Gentlymad-Studios / NewGraph

A general node graph solution centered on data management. This is based on the idea to visualize complex data structures as graph networks without having to modify already established data classes.
MIT License
244 stars 19 forks source link

Leak detected message after recompiling project #16

Open leissler opened 1 year ago

leissler commented 1 year ago

Right at the first domain reload, the following message appears in the console (working with MonoGraphModel):

Leak Detected : Persistent allocates 4 individual allocations.

When setting Preferences > Jobs > Leak Detection Level to "Enabled with Stack Trace", it produces the following extended message:

Found 4 leak(s) from callstack:
 #0  (Mono JIT Code) [PortView.cs:21] NewGraph.PortView:.ctor (NewGraph.PortInfo,UnityEditor.SerializedProperty,System.Action)
 #1  (Mono JIT Code) [NodeController.cs:102] NewGraph.NodeController:DoForEachPortProperty (System.Action`2<NewGraph.PortInfo, UnityEditor.SerializedProperty>)
 #2 ???
 #3 UnsafeUtility::Malloc(long long, int, NativeCollection::Allocator, ScriptingExceptionPtr*)
 #4 ???
 #5 ???
 #6 ???
 #7 ???
 #8 ???
 #9 ???
 #10 ???
 #11 mono_threads_enter_gc_unsafe_region_internal
 #12 ???
 #13 ???
 #14 ???
 #15 mono_thread_interruption_checkpoint_request
 #16 ???
 #17 ???
 #18 ???
 #19 ???
Doppelkeks commented 1 year ago

Unable to reproduce on a windows machine... I require a repro project.

leissler commented 1 year ago

Project incoming via DM...

loosegrid commented 7 months ago

@Doppelkeks I have this issue too, after every recompile when there's a non-empty graph window open (or it was open, even if closed before recompiling). The issue seems to come from NodeView.CreatePortUI / GraphViewBase.BasePort:get_PortCircleGraphics.

I'm on Unity 2022.3.22f1 and cloned the repo manually. Only change I've made to it is removing the tilde from the Samples folder so it would be recognized by Unity. Before this, I tried creating nodes with a Monobehaviour class, which threw different errors. I deleted that entire graph model asset and closed and reopened the project so I think that is unrelated.

Full callstacks:

Found 1 leak(s) from callstack:
0x000002851b045193 (Mono JIT Code) Unity.Collections.NativeArray`1<UnityEngine.UIElements.Vertex>:Allocate (int,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<UnityEngine.UIElements.Vertex>&)
0x000002851b044d93 (Mono JIT Code) Unity.Collections.NativeArray`1<UnityEngine.UIElements.Vertex>:.ctor (int,Unity.Collections.Allocator,Unity.Collections.NativeArrayOptions)
0x000002851b044ad3 (Mono JIT Code) UnityEngine.UIElements.UIR.TempAllocator`1<UnityEngine.UIElements.Vertex>:.ctor (int,int,int)
0x00000285568964e3 (Mono JIT Code) UnityEngine.UIElements.UIR.DetachedAllocator:.ctor ()
0x00000285568961b3 (Mono JIT Code) UnityEngine.UIElements.Painter2D:.ctor ()
0x00000285568959f3 (Mono JIT Code) GraphViewBase.BasePort:get_PortCircleGraphics () (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/Graph/BasePort.cs:36)
0x0000028556895383 (Mono JIT Code) GraphViewBase.BasePort:.ctor (GraphViewBase.Orientation,GraphViewBase.Direction,GraphViewBase.PortCapacity) (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/Graph/BasePort.cs:68)
0x0000028556894593 (Mono JIT Code) NewGraph.PortView:.ctor (NewGraph.PortInfo,UnityEditor.SerializedProperty,System.Action) (at (project path)/Assets/NewGraph/Editor/Views/PortView.cs:20)
0x000002855689408b (Mono JIT Code) NewGraph.NodeView:CreatePortUI (NewGraph.PortInfo,UnityEditor.SerializedProperty) (at (project path)/Assets/NewGraph/Editor/Views/NodeView.cs:114)
0x0000028556893e83 (Mono JIT Code) NewGraph.NodeView:CreateOuputPortUI (NewGraph.PortInfo,UnityEditor.SerializedProperty) (at (project path)/Assets/NewGraph/Editor/Views/NodeView.cs:110)
0x0000028556893bb6 (Mono JIT Code) NewGraph.NodeController:DoForEachPortPropertyBase (System.Collections.Generic.List`1<NewGraph.PortInfo>&,System.Action`2<NewGraph.PortInfo, UnityEditor.SerializedProperty>) (at (project path)/Assets/NewGraph/Editor/Controllers/NodeController.cs:102)
0x0000028556893903 (Mono JIT Code) NewGraph.NodeController:DoForEachPortProperty (System.Action`2<NewGraph.PortInfo, UnityEditor.SerializedProperty>) (at (project path)/Assets/NewGraph/Editor/Controllers/NodeController.cs:107)
0x00000285568904d3 (Mono JIT Code) NewGraph.NodeView:InitializeView () (at (project path)/Assets/NewGraph/Editor/Views/NodeView.cs:55)
0x000002855688eb0b (Mono JIT Code) NewGraph.NodeController:Initialize () (at (project path)/Assets/NewGraph/Editor/Controllers/NodeController.cs:60)
0x0000028556874253 (Mono JIT Code) NewGraph.GraphController/<>c__DisplayClass43_0:<Load>g__ForEachNodeProperty|1 (System.Collections.Generic.List`1<NewGraph.NodeModel>,UnityEditor.SerializedProperty) (at (project path)/Assets/NewGraph/Editor/Controllers/GraphController.cs:476)
0x000002855686d143 (Mono JIT Code) NewGraph.GraphController/<>c__DisplayClass43_0:<Load>b__0 () (at (project path)/Assets/NewGraph/Editor/Controllers/GraphController.cs:483)
0x00000284c9e62490 (Mono JIT Code) UnityEngine.UIElements.VisualElement/SimpleScheduledItem:PerformTimerUpdate (UnityEngine.UIElements.TimerState)
0x00000284c9e5bfc7 (Mono JIT Code) UnityEngine.UIElements.TimerEventScheduler:UpdateScheduledEvents ()
0x00000284c9e5d99b (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers ()
Found 1 leak(s) from callstack:
0x000002851b049013 (Mono JIT Code) Unity.Collections.NativeArray`1<uint16>:Allocate (int,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<uint16>&)
0x000002851b048c13 (Mono JIT Code) Unity.Collections.NativeArray`1<uint16>:.ctor (int,Unity.Collections.Allocator,Unity.Collections.NativeArrayOptions)
0x000002851b048953 (Mono JIT Code) UnityEngine.UIElements.UIR.TempAllocator`1<uint16>:.ctor (int,int,int)
0x000002855689658b (Mono JIT Code) UnityEngine.UIElements.UIR.DetachedAllocator:.ctor ()
0x00000285568961b3 (Mono JIT Code) UnityEngine.UIElements.Painter2D:.ctor ()
0x00000285568959f3 (Mono JIT Code) GraphViewBase.BasePort:get_PortCircleGraphics () (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/Graph/BasePort.cs:36)
0x0000028556895383 (Mono JIT Code) GraphViewBase.BasePort:.ctor (GraphViewBase.Orientation,GraphViewBase.Direction,GraphViewBase.PortCapacity) (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/Graph/BasePort.cs:68)
0x0000028556894593 (Mono JIT Code) NewGraph.PortView:.ctor (NewGraph.PortInfo,UnityEditor.SerializedProperty,System.Action) (at (project path)/Assets/NewGraph/Editor/Views/PortView.cs:20)
0x000002855689408b (Mono JIT Code) NewGraph.NodeView:CreatePortUI (NewGraph.PortInfo,UnityEditor.SerializedProperty) (at (project path)/Assets/NewGraph/Editor/Views/NodeView.cs:114)
0x0000028556893e83 (Mono JIT Code) NewGraph.NodeView:CreateOuputPortUI (NewGraph.PortInfo,UnityEditor.SerializedProperty) (at (project path)/Assets/NewGraph/Editor/Views/NodeView.cs:110)
0x0000028556893bb6 (Mono JIT Code) NewGraph.NodeController:DoForEachPortPropertyBase (System.Collections.Generic.List`1<NewGraph.PortInfo>&,System.Action`2<NewGraph.PortInfo, UnityEditor.SerializedProperty>) (at (project path)/Assets/NewGraph/Editor/Controllers/NodeController.cs:102)
0x0000028556893903 (Mono JIT Code) NewGraph.NodeController:DoForEachPortProperty (System.Action`2<NewGraph.PortInfo, UnityEditor.SerializedProperty>) (at (project path)/Assets/NewGraph/Editor/Controllers/NodeController.cs:107)
0x00000285568904d3 (Mono JIT Code) NewGraph.NodeView:InitializeView () (at (project path)/Assets/NewGraph/Editor/Views/NodeView.cs:55)
0x000002855688eb0b (Mono JIT Code) NewGraph.NodeController:Initialize () (at (project path)/Assets/NewGraph/Editor/Controllers/NodeController.cs:60)
0x0000028556874253 (Mono JIT Code) NewGraph.GraphController/<>c__DisplayClass43_0:<Load>g__ForEachNodeProperty|1 (System.Collections.Generic.List`1<NewGraph.NodeModel>,UnityEditor.SerializedProperty) (at (project path)/Assets/NewGraph/Editor/Controllers/GraphController.cs:476)
0x000002855686d143 (Mono JIT Code) NewGraph.GraphController/<>c__DisplayClass43_0:<Load>b__0 () (at (project path)/Assets/NewGraph/Editor/Controllers/GraphController.cs:483)
0x00000284c9e62490 (Mono JIT Code) UnityEngine.UIElements.VisualElement/SimpleScheduledItem:PerformTimerUpdate (UnityEngine.UIElements.TimerState)
0x00000284c9e5bfc7 (Mono JIT Code) UnityEngine.UIElements.TimerEventScheduler:UpdateScheduledEvents ()
0x00000284c9e5d99b (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers ()