Posts Tagged dispose

Deallocating Temp Memory: Part 3

Tags: , , ,

Continuing the series, today we look specifically at “overflow” allocations in the Temp allocator. We’ve seen that there’s no need to explicitly deallocate Temp memory because it all gets cleared every frame, but do we need to deallocate “overflow” allocations that didn’t fit inside the block of automatically-cleared memory? Today we’ll find out!

Read the rest of this article »

No Comments

What Does Deallocating Temp Memory Do?

Tags: , , ,

Last week we learned a lot about Allocator.Temp, but we left some questions open. One of them was what happens when we explicitly deallocate Temp memory. We know we don’t need to and that it’ll be deallocated at the end of the frame, but what happens when we explicitly deallocate it? Today we’ll dive in and try to find out.

Read the rest of this article »

4 Comments

How Long Does a Temp Allocation Last?

Tags: , ,

When we use Allocator.Temp with a collection like NativeArray, how long does the allocation last? We’ve seen that Temp allocations are automatically disposed without the need to explicitly call Dispose, but when does the automatic dispose happen? Today we’ll test to find out!

Read the rest of this article »

1 Comment

File I/O Performance Tips

Tags: , , , , , ,

At some point, every project ends up reading or writing to the file system. If you do anything more than storing a single blob of bytes (e.g. JSON text) then you’ll need to be very careful about performance. It’s easy to accidentally write code that takes way longer to read and write than it should and you won’t get any help from the compiler or from Unity. Today’s article reveals some of these traps so you won’t fall into them!

Read the rest of this article »

13 Comments