Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug Random error " Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate! "

Discussion in 'Unity Transport' started by Kichang-Kim, Apr 26, 2022.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    887
    Hi. I found that when I test my project which using Unity Transport 1.0.0, it shows random error like this:

    Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!


    But it has no stack trace, so I can't figure out what make this error. It does not occurred when play offline mode or editor, only shown when play in iOS device with Unity Transport enabled.

    Any ideas?

    Thanks.
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    150
    Are you using Unity Transport on its own or in conjunction with Netcode for GameObjects? We've had a report of the same error recently, but coming from Netcode from GameObjects. Also what editor version are you using?

    Otherwise, the lack of stack trace would tend to indicate that this error could be coming from a Burst-compiled job. If you have a way of reproducing this reliably, could you try to reproduce it with Burst disabled (you'll need to disable it both from the Jobs menu and from the Burst AOT settings in your project settings).
     
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    887
    I used Unity Transport directly with Unity 2021.3.0f1. I will report if I find reproducing steps.
     
  4. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    887
    Hmm, It has no stack-trace even Burst Compilation is disabled. (Other logs from Job shows stack trace correctly.)
     
  5. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    887
    I found that increasing queueCapacity and maximumPayloadSize by using NetworkSettings.WithBaselibNetworkInterfaceParameters() makes that this error is disappeared.
     
  6. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    150
    Had a quick look at it, and the error is actually coming from deep inside native memory management code, where no stack traces are outputted. If you have access to an editor version >2022.1.0a13, there should be a "-diag-temp-memory-leak-validation" console switch to enable more diagnostics.

    Interesting that increasing queue capacities and maximum payload size solved the issue. That does help narrowing it down a bit. Thanks for reporting your findings! If you find out anything else, please let us know.