Use the [DeallocateOnJobCompletion] attribute but this only works with NativeArrays which limits it considerably. It also requires making a job describing each array type input, which is more boilerplate.
Are there any other methods I’ve missed? It would be nice to have some sort of allocate and dispose once job is complete for any Disposable type to save a lot of generic typing?
Do not forget to also dispose the nativeContainer in OnStopRunning when using method 1, so the container is also disposed when OnUpdate is no longer being called.