docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method TrimExcess

    TrimExcess()

    Removes any excess capacity in the buffer.

    Declaration
    public void TrimExcess()
    Remarks

    Sets the buffer capacity to the current length. If the buffer memory size changes, the current contents of the buffer are copied to a new block of memory and the old memory is freed. If the buffer now fits in the space in the chunk reserved with InternalBufferCapacityAttribute, then the buffer contents are moved to the chunk.

    Examples
    if (buffer.Capacity > buffer.Length)
        buffer.TrimExcess();
    In This Article
    Back to top
    Copyright © 2024 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)