Raxol.Terminal.Buffer.Manager.Memory (Raxol v0.3.0)
View SourceHandles memory management for the terminal buffer. Provides functionality for tracking memory usage and enforcing limits.
Summary
Functions
Calculates memory usage for a specific buffer.
Estimates memory usage for a given buffer size.
Gets the memory limit.
Gets the current memory usage.
Sets a new memory limit.
Updates memory usage tracking.
Checks if memory usage is within limits.
Checks if a given buffer size would exceed memory limits.
Functions
Calculates memory usage for a specific buffer.
Examples
iex> state = State.new(80, 24)
iex> Memory.calculate_buffer_usage(state.active_buffer) > 0
true
Estimates memory usage for a given buffer size.
Examples
iex> Memory.estimate_usage(80, 24, 1000) > 0
true
Gets the memory limit.
Examples
iex> state = State.new(80, 24)
iex> Memory.get_limit(state)
10_000_000
Gets the current memory usage.
Examples
iex> state = State.new(80, 24)
iex> state = Memory.update_usage(state)
iex> Memory.get_usage(state) > 0
true
Sets a new memory limit.
Examples
iex> state = State.new(80, 24)
iex> state = Memory.set_limit(state, 5_000_000)
iex> Memory.get_limit(state)
5_000_000
Updates memory usage tracking.
Examples
iex> state = State.new(80, 24)
iex> state = Memory.update_usage(state)
iex> state.memory_usage > 0
true
Checks if memory usage is within limits.
Examples
iex> state = State.new(80, 24)
iex> Memory.within_limits?(state)
true
Checks if a given buffer size would exceed memory limits.
Examples
iex> state = State.new(80, 24)
iex> Memory.would_exceed_limit?(state, 100, 50, 2000)
false