question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native Collection has not been disposed, resulting in a memory leak.

See original GitHub issue

This happened in 2021.1. Every time I press “Play” button, they appear in console. I used com.unity.jobs and caught these:

A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator) UnityEngine.Networking.UploadHandlerRaw:.ctor(Byte[]) WakaTime.Plugin:SendHeartbeat(Boolean) (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:145) WakaTime.Plugin:OnSceneClosing(Scene, Boolean) (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:205) UnityEditor.SceneManagement.EditorSceneManager:Internal_SceneClosing(Scene, Boolean)

A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator) UnityEngine.Networking.UploadHandlerRaw:.ctor(Byte[]) WakaTime.Plugin:SendHeartbeat(Boolean) (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:145) WakaTime.Plugin:Initialize() (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:62) WakaTime.Plugin:OnScriptReload() (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:181)

A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator) UnityEngine.Networking.UploadHandlerRaw:.ctor(Byte[]) WakaTime.Plugin:SendHeartbeat(Boolean) (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:145) WakaTime.Plugin:OnPlaymodeStateChanged(PlayModeStateChange) (at Library\PackageCache\com.vladfaust.unitywakatime@4dedbeac2e\Editor\Plugin.cs:185) UnityEditor.EditorApplication:Internal_PlayModeStateChanged(PlayModeStateChange) UnityEditor.EditorApplication:set_isPlaying(Boolean) Unity.Entities.Editor.LiveLinkToolbar:TogglePlaying() (at Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities.Editor\LiveLink\LiveLinkToolbar.cs:94) Unity.Entities.Editor.LiveLinkToolbar:DrawPlaybar(CommandExecuteContext) (at Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities.Editor\LiveLink\LiveLinkToolbar.cs:60) UnityEditor.CommandService:ExecuteCommand(String, CommandHint, Object[]) UnityEditor.CommandService:Execute(String, CommandHint, Object[]) UnityEditor.ModeService:Execute(String, CommandHint, Object[]) UnityEditor.ModeService:Execute(String, Object[]) UnityEditor.Toolbars.PlayModeButtons:OverrideGUIHandler() UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect, Action, Boolean) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect, Action, Boolean) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Action, Boolean) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Boolean) UnityEngine.UIElements.IMGUIContainer:SendEventToIMGUIRaw(EventBase, Boolean, Boolean) UnityEngine.UIElements.IMGUIContainer:SendEventToIMGUI(EventBase, Boolean, Boolean) UnityEngine.UIElements.IMGUIContainer:HandleEvent(EventBase) UnityEngine.UIElements.CallbackEventHandler:HandleEventAtTargetPhase(EventBase) UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent(EventBase, IPanel) UnityEngine.UIElements.EventDispatcher:ApplyDispatchingStrategies(EventBase, IPanel, Boolean) UnityEngine.UIElements.EventDispatcher:ProcessEvent(EventBase, IPanel) UnityEngine.UIElements.EventDispatcher:ProcessEventQueue() UnityEngine.UIElements.EventDispatcher:OpenGate() UnityEngine.UIElements.EventDispatcherGate:Dispose() UnityEngine.UIElements.EventDispatcher:ProcessEvent(EventBase, IPanel) UnityEngine.UIElements.EventDispatcher:Dispatch(EventBase, IPanel, DispatchMode) UnityEngine.UIElements.BaseVisualElementPanel:SendEvent(EventBase, DispatchMode) UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent(Int32, IntPtr, Boolean&) UnityEngine.UIElements.UIEventRegistration:ProcessEvent(Int32, IntPtr) UnityEngine.UIElements.<>c:<.cctor>b__1_2(Int32, IntPtr) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
BrianLDevcommented, Sep 12, 2022

@alanhamlett Can we remove the link to vladfaust’s version of unity wakatime from Wakatime’s website? This bug has been unresolved for 1.5 years and there are better alternatives without the bug. Or at least put the link at the bottom of the list with a note that it has unresolved bugs.

4reactions
vanBassumcommented, Sep 9, 2022

Since this problem still isn’t fixed, I decided to create my own plugin. Used this one as example, but I started from zero in order to create better readable code. At the risk of being flamed for shameless advertising, https://github.com/vanBassum/Wakatime.Unity 😃

Please give it a try, and let me know if anything needs tweaking.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Native Collection has not been disposed, resulting in a ...
A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details. Click to expand... I...
Read more >
A Native Collection has not been disposed, resulting in ...
This can help you determine which script is creating the memory leak and which part of that script is leaking. As for when...
Read more >
A Native Collection has not been disposed, resulting in ...
The error "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.
Read more >
A Native Collection has not been disposed resulting in a ...
A Native Collection has not been disposed resulting in a memory leak Enable Full Stack Traces to get more details . facebook page ......
Read more >
A Native Collection has not been disposed after adding ...
A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Byte[], ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found