Raxol.Terminal.Buffer.MemoryManager (Raxol v0.4.0)
View SourceHandles calculation and checking of terminal buffer memory usage.
Summary
Functions
Calculates the approximate memory usage of a single screen buffer.
Calculates the total approximate memory usage for two buffers (active and back).
Checks if the given memory usage is within the specified limit.
Functions
@spec calculate_buffer_usage(Raxol.Terminal.ScreenBuffer.t()) :: non_neg_integer()
Calculates the approximate memory usage of a single screen buffer.
This is a rough estimation based on buffer dimensions and an estimated cell size.
@spec get_total_usage( Raxol.Terminal.ScreenBuffer.t(), Raxol.Terminal.ScreenBuffer.t() ) :: non_neg_integer()
Calculates the total approximate memory usage for two buffers (active and back).
@spec is_within_limit?(non_neg_integer(), non_neg_integer()) :: boolean()
Checks if the given memory usage is within the specified limit.