Raxol.Terminal.MemoryManager (Raxol v0.3.0)

View Source

Monitors and manages memory usage for terminal processes.

Can trigger actions like trimming scrollback when limits are exceeded.

Summary

Functions

Checks if memory usage exceeds the limit and performs cleanup if necessary.

Returns a specification to start this module under a supervisor.

Estimates the total memory usage of the terminal state.

Performs memory cleanup operations on relevant terminal components.

Functions

check_and_cleanup(state)

Checks if memory usage exceeds the limit and performs cleanup if necessary.

This function should be called periodically.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

estimate_memory_usage(state)

@spec estimate_memory_usage(Raxol.Terminal.Integration.State.t()) :: non_neg_integer()

Estimates the total memory usage of the terminal state.

Sums the memory usage of the buffer manager, scroll buffer, and other relevant components. Returns the total in bytes.

perform_cleanup(state)

Performs memory cleanup operations on relevant terminal components.

Currently focuses on trimming the buffer manager.