libmemalloc  v4.0.00
Modern Memory Allocator
Loading...
Searching...
No Matches
gc_thread_t Struct Reference

Orchestrates the background mark-and-sweep garbage collector. More...

#include <libmemalloc.h>

Collaboration diagram for gc_thread_t:

Public Attributes

pthread_t gc_thread
 
pthread_t main_thread
 
bool gc_running
 
bool gc_exit
 
uint16_t gc_thread_started
 
uint32_t gc_interval_ms
 
pthread_cond_t gc_cond
 
pthread_mutex_t gc_lock
 

Detailed Description

Orchestrates the background mark-and-sweep garbage collector.

The structure encapsulates all state and synchronization needed to run the garbage collector in its own thread. Once started, the GC thread will periodically wake up, scan the heap and any mapped regions for unreachable objects, reclaim them, and then sleep again. The structure holds the timing parameters, the thread handle, and the primitives used to signal the collector to start or stop its work.

Fields:
  • gc_thread – Handle to the GC pthread
  • main_thread – Handle to the application’s main pthread
  • gc_running – Whether the GC thread is active and should run
  • gc_exit – Signal for the GC thread to exit
  • gc_interval_ms – Interval between GC cycles, in milliseconds
  • gc_thread_started – Flag indicating the GC thread has been created
  • gc_cond – Condition variable to signal GC thread
  • gc_lock – Mutex for synchronizing GC start/stop

Member Data Documentation

◆ gc_cond

pthread_cond_t gc_thread_t::gc_cond

Condition variable for GC signaling

◆ gc_exit

bool gc_thread_t::gc_exit

Flag to signal GC shutdown

◆ gc_interval_ms

uint32_t gc_thread_t::gc_interval_ms

Interval between GC cycles (ms)

◆ gc_lock

pthread_mutex_t gc_thread_t::gc_lock

Mutex protecting the condition

◆ gc_running

bool gc_thread_t::gc_running

Flag indicating GC is running

◆ gc_thread

pthread_t gc_thread_t::gc_thread

GC thread handle

◆ gc_thread_started

uint16_t gc_thread_t::gc_thread_started

Indicates whether GC thread has started

◆ main_thread

pthread_t gc_thread_t::main_thread

Main thread handle


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