Last time we saw that jobs apparently have their own
Temp allocator. Still, it was unclear how many of these allocators there are. One per job job? One per thread? Just one? Today we’ll run an experiment to find the answer!
Posts Tagged job
Temp memory is backed by a fixed size block that’s cleared by Unity every frame. Allocations on subsequent frames return pointers to this same block. The allocated memory therefore isn’t unique. How much of a problem is this? Today we’ll do some experiments to find out!
What do you do when a job you’re writing needs to allocate memory? You could allocate it outside of the job and pass it in, but that presents several problems. You can also allocate memory from within a job. Today we’ll look into how that works and some limitations that come along with it.
Job structs can’t contain managed types like
class instances, or delegates. This is currently a pain as a lot of the Unity API relies on these and so we’re forced to deal with them. Today we’ll talk about how we can use managed types in our jobs to bridge the gap.
Normally Burst-compiled jobs can’t use managed arrays, but there’s an exception for
static readonly fields. This comes with several dangers, which we’ll explore today.
With each new release of Unity, more and more job-safe APIs are added. Today we’ll look at the new ones and learn how we can move even more code into high-performance C# jobs.
Unity’s C# job system is a powerful tool, but it can be difficult to understand how various jobs, their dependencies on each other, and the data they use all work together to accomplish a task. Today we’ll create a little tool that visualizes and generates job graphs so it’s much easier to understand them and easier to build larger, more powerful graphs.