docs.unity3d.com
Search Results for

    Show / Hide Table of Contents
    Note

    Sentis is now called Inference Engine. The documentation has moved to https://docs.unity3d.com/Packages/com.unity.ai.inference@latest. Refer to the new location for the latest updates and guidance. Make sure to update your bookmarks and references accordingly.

    Manage memory

    As a Sentis user, you're responsible for calling Dispose on workers and tensors you instantiate. You must also call Dispose on cloned output tensors returned from the ReadbackAndClone method.

    Note

    Calling Dispose is necessary to free up graphics processing unit (GPU) resources.

    For example:

    void OnDestroy()
    {
        worker?.Dispose();
    
        // Assuming model with multiple inputs that were passed as a array
        foreach (var input in inputs)
        {
            input.Dispose();
        }
    }
    

    When you get a handle to a tensor from a worker using the PeekOutput method, the memory allocator remains responsible for that memory. You don't need to Dispose of it. Refer to Get output from a model for more information.

    Additional resources

    • Profile a model
    • Create an engine to run a model
    • Create and modify tensors
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)