|
memory_arena
|
Arena snapshot serialization and deserialization. More...
Include dependency graph for arena_io.c:Go to the source code of this file.
Functions | |
| bool | arena_load_from_file (t_arena *arena, const char *path) |
| Load arena contents from a snapshot file. | |
| bool | arena_save_to_file (const t_arena *arena, const char *path) |
| Save the current contents of an arena to a file. | |
Arena snapshot serialization and deserialization.
This file provides I/O utilities for saving and loading arena memory snapshots to and from binary files. It enables serialization of the arena's buffer content for persistence or debugging purposes.
Functions included:
arena_save_to_file(): Save the current contents of an arena to a .bin file.arena_load_from_file(): Load previously saved contents into an arena buffer.Features:
owns_buffer == true) are supported.This functionality is particularly useful for:
Definition in file arena_io.c.
| bool arena_load_from_file | ( | t_arena * | arena, |
| const char * | path | ||
| ) |
Load arena contents from a snapshot file.
This function reads a snapshot file created with arena_save_to_file() and writes the contents into the provided arena buffer.
The arena must have been initialized with a buffer large enough to hold the restored data. The arena's internal offset will be updated accordingly.
| arena | Pointer to the arena to restore. |
| path | Path to the snapshot file. |
true on success, false on failure. Definition at line 255 of file arena_io.c.
References ARENA_SNAPSHOT_MAGIC, and ARENA_SNAPSHOT_VERSION.
| bool arena_save_to_file | ( | const t_arena * | arena, |
| const char * | path | ||
| ) |
Save the current contents of an arena to a file.
This function writes a snapshot of the arena to the specified file path. The snapshot includes a header and all memory up to arena->offset.
| arena | Pointer to the arena to save. |
| path | Path to the output file. |
true on success, false on failure. Definition at line 161 of file arena_io.c.
References ARENA_LOCK, ARENA_SNAPSHOT_MAGIC, ARENA_SNAPSHOT_VERSION, ARENA_UNLOCK, and used.