Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by joshrs926 · Jan 31, 2021 at 06:27 PM · editor-scriptingdotswarningwarnings

How do I fix "JobTempAlloc has allocations that are more than 4 frames old" when I'm not actually using Allocator.TempJob?

In my DOTS project, I am getting this error:

Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak

whenever I run my DOTS based scripts. The project is an editor tool so I am running it in the editor.

I am not using Allocator.TempJob anywhere in the scripts that cause this error. I'm only using Allocator.Persistent and then disposing those arrays after all the jobs complete and using Allocator.Temp for arrays allocated and disposed of within jobs. I already tried changing all the Allocator.Temp's to Persistents and that didn't help. I am scheduling Jobs with dependencies to each other and then checking for when they complete every frame using EditorApplication.update. This way they run in the background and don't halt the main thread. When the work is relatively small, I don't get the error, but when I give the tool a bigger task to complete I get this error message.

I also noticed that when I schedule the jobs and then immediately call jobHandle.Complete() I get no warning no matter how large the jobs are. The warning only comes when I call schedule and then check jobHandle.IsCompleted every frame and then call jobHandle.Complete() when that returns true.

I am using UnsafeList in these jobs as well. I am doing so so that I can have arrays of arrays in jobs. I do this by using NativeArray>.


Does Unity perhaps create jobs behind the scenes that use TempJob allocators in order to schedule jobs or copy NativeArrays or combine JobHandles or anything like that? If so then I could try to identify what's too big for Unity's behind the scenes job and split it up into smaller chunks.


I can try to create a project with the error reproducible if anyone wants to take a look. I am using Unity 2019.4.10f1 for this project.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by andrew-lukasik · Feb 01, 2021 at 02:11 PM


Does this warning message details specific line where allocation happened?

Yes - Case solved, pretty much. Just fix the code it points to (i.e. make sure this allocation is released).

No - My bet is on packages in use or their dependencies. This is not about workload per se but what specific code it triggers; animation? - look into animation packages, rendering - look into rendering packages, yyy??? - look into core dots packages, it well may be their fault in some cases.


Sidenote:

Do not change the Allocator type to Persistent everywhere. It will hide allocation problems instead of fixing them. Use it only when this specific data piece is really a persistent one i.e. is intendent to exist for very long time.


Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image joshrs926 · Feb 02, 2021 at 09:58 PM 0
Share

It does not give any indication of where the allocation is happening. I do think it has something to do with work load. The specific scripts involved take in a number of arguments when they are called to do work. When I give small numbers as arguments, the jobs complete quickly and I get no warnings. But when I give bigger numbers the jobs take longer and I get the warnings. I only get the warnings when I give those bigger numbers.

I agree that using persistent can hide allocation problems, but I cannot use Allocator.TempJob as my jobs take hundreds of frames to complete and TempJob only works for jobs that take 4 or less frames. This is all taking place in the editor, not in play mode, so perhaps that might be influencing things.

avatar image andrew-lukasik joshrs926 · Feb 02, 2021 at 11:14 PM 0
Share

Not sure what "bigger numbers" means exactly but you may want to make sure you're not allocating crazy amount of memory as a result and/or tripping over some hard-coded system/world limits (those exist and time just well may be one of those, idk). Because even non-consequential SetName is restricted to some amount (thousands) of calls after which it starts to throw exceptions.

avatar image joshrs926 andrew-lukasik · Feb 03, 2021 at 06:10 PM 1
Share

I say “bigger numbers” because I’m trying not to bring in the actual algorithms used so I can just keep it simple for now. I’m still in the process of trying to whittle down the code to find the cause of the warning. I think you might be on to something regarding not allocating too much memory and I think it might be the time dimension that’s the problem. I wonder if the content in this article https://www.jacksondunstan.com/articles/5472 might be related to my problem. I mentioned I can’t use Allocator.TempJob because my jobs are long running. Is that right? The NativeArrays contain data that is only used in the job and then disposed after the job completes so ideally they should be TempJob data. Is there any way to use Allocator.TempJob for long running jobs? I appreciate you’re help.

avatar image joshrs926 · Feb 04, 2021 at 05:06 PM 0
Share

I added a few more details to my original post that may be relevant. I am using UnsafeList in the project. Whenever I immediately call jobHandle.Complete() after scheduling the jobs I get no warnings. The warnings only come when I schedule the jobs and then check if they are complete every frame and then call jobHandle.Complete() once jobHandle.IsCompleted returns true.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

123 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

implicit downcast 'Object' to "UnityEngine.Quaternion" 1 Answer

why do i get this warining when there is a main camera? 0 Answers

Box Collider 2D -failed verification- warning even when the size is reasonable 2 Answers

Attempt to insert 9Slice RenderData twice warning in erroneous places 0 Answers

SendMessage cannot be called during Awake, CheckConsistency, or OnValidate 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges