libghostty-vt 0.0.0
Loading...
Searching...
No Matches
GhosttyTerminalMemoryUsage Struct Reference

#include <ghostty/vt/terminal.h>

Data Fields

size_t size
bool compression_supported
uint64_t primary_pages
uint64_t primary_virtual_bytes
uint64_t primary_resident_bytes
uint64_t primary_compressed_pages
uint64_t primary_compressed_bytes
uint64_t primary_image_bytes
uint64_t alternate_pages
uint64_t alternate_virtual_bytes
uint64_t alternate_resident_bytes
uint64_t alternate_compressed_pages
uint64_t alternate_compressed_bytes
uint64_t alternate_image_bytes

Detailed Description

Memory held by a terminal.

Read with ghostty_terminal_get() and GHOSTTY_TERMINAL_DATA_MEMORY_USAGE.

This is a sized struct. Initialize it with GHOSTTY_INIT_SIZED() before passing it to ghostty_terminal_get(). See Sized Structs.

Each screen has its own set of fields, named with a primary_ or alternate_ prefix. Add the two sets together for the terminal's total. The alternate fields are all zero until a program first switches to that screen.

See Memory use for what these figures cover and which one to budget against.

Examples
c-vt-compression/src/main.c.

Definition at line 468 of file terminal.h.

Field Documentation

◆ alternate_compressed_bytes

uint64_t alternate_compressed_bytes

The same as primary_compressed_bytes, for the alternate screen.

Definition at line 527 of file terminal.h.

◆ alternate_compressed_pages

uint64_t alternate_compressed_pages

The same as primary_compressed_pages, for the alternate screen.

Definition at line 524 of file terminal.h.

◆ alternate_image_bytes

uint64_t alternate_image_bytes

The same as primary_image_bytes, for the alternate screen.

Examples
c-vt-compression/src/main.c.

Definition at line 530 of file terminal.h.

◆ alternate_pages

uint64_t alternate_pages

The same as primary_pages, for the alternate screen.

Definition at line 515 of file terminal.h.

◆ alternate_resident_bytes

uint64_t alternate_resident_bytes

The same as primary_resident_bytes, for the alternate screen.

Examples
c-vt-compression/src/main.c.

Definition at line 521 of file terminal.h.

◆ alternate_virtual_bytes

uint64_t alternate_virtual_bytes

The same as primary_virtual_bytes, for the alternate screen.

Definition at line 518 of file terminal.h.

◆ compression_supported

bool compression_supported

Whether compressing scrollback can free memory on this platform. When false, ghostty_terminal_compress() reports GHOSTTY_TERMINAL_COMPRESSION_RESULT_UNSUPPORTED and the compressed fields are always zero. To reduce a terminal's memory on such a platform, you have to do something else, such as closing it.

Definition at line 479 of file terminal.h.

◆ primary_compressed_bytes

uint64_t primary_compressed_bytes

Bytes of compressed data held for the primary screen's compressed pages. This is already included in primary_resident_bytes.

Definition at line 505 of file terminal.h.

◆ primary_compressed_pages

uint64_t primary_compressed_pages

Number of the primary screen's pages that are compressed.

Definition at line 499 of file terminal.h.

◆ primary_image_bytes

uint64_t primary_image_bytes

Bytes of image data stored for the primary screen through the Kitty graphics protocol. This is not included in primary_resident_bytes. Always zero when libghostty-vt is built without Kitty graphics.

Examples
c-vt-compression/src/main.c.

Definition at line 512 of file terminal.h.

◆ primary_pages

uint64_t primary_pages

Number of pages in the primary screen, including compressed pages.

Definition at line 482 of file terminal.h.

◆ primary_resident_bytes

uint64_t primary_resident_bytes

Bytes of physical memory used by the primary screen's pages. A compressed page counts only its compressed size. Use this figure for memory budgets.

Examples
c-vt-compression/src/main.c.

Definition at line 496 of file terminal.h.

◆ primary_virtual_bytes

uint64_t primary_virtual_bytes

Bytes of address space reserved for the primary screen's pages. This includes compressed pages and spare pages kept ready for reuse. Always at least primary_resident_bytes.

Definition at line 489 of file terminal.h.

◆ size

size_t size

Size of this struct in bytes. Set by you.

Definition at line 470 of file terminal.h.


The documentation for this struct was generated from the following file: