Posts Tagged idisposable

Sharing IDisposables

Tags: , , ,

IDisposable is becoming more and more prevalent in Unity. Previously, it was typically only used for I/O types like FileStream. Now it’s used for in-memory types like NativeArray<T> to avoid the garbage collector. Needing to call Dispose manually means we’re explicitly managing memory, just like we’d do in lower-level languages like C++. That comes with some challenges, especially with shared ownership, which we’ll deal with today.

Read the rest of this article »

8 Comments

From AS3 to C#, Part 18: Resource Allocation and Cleanup

Tags: , , , , ,

Today we continue the series by looking at how resources—primarily memory—are acquired and cleaned up in C#. We’ll go way beyond the new operator and discuss advanced features like finalizers and using blocks that can make releasing resources much less prone to errors. Read on to learn!

Read the rest of this article »

No Comments