Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NativeList Allocator.Persistent "deleting an allocation that is older than its permitted lifetime o"

Discussion in 'Entity Component System' started by Ziddon, Jun 23, 2022.

  1. Ziddon

    Ziddon

    Joined:
    Feb 6, 2015
    Posts:
    23
    Hi, quick question.

    I have a sequence of Jobs that use a few Nativelists that are all allocated with Allocator.Persistent.
    Code (CSharp):
    1. new NativeList<float>(storageSize, Allocator.Persistent)
    new NativeList<float>(storageSize, Allocator.Persistent)

    Inside one of the jobs I need to change the capacity
    Code (CSharp):
    1. noiseStorage.SetCapacity(requiredStorage);
    If I run too many of these guys I get
    "Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)"
    Age varies depending on how many jobs I'm running.

    I'm wondering if my capacity resize has anything to do with this, does the NativeList get re-allocated with allocation type TempJob? Does this error sometimes happen with Persistent data structures? Or am I just losing it and I simply have something else wrong with my code?

    Any guidance would be very much appreciated :).


    Thanks!!!
     
    mercykeepers likes this.