JULEA
Data Structures | Typedefs | Functions
Memory Chunk

Data Structures

struct  JMemoryChunk
 

Typedefs

typedef struct JMemoryChunk JMemoryChunk
 

Functions

JMemoryChunkj_memory_chunk_new (guint64 size)
 
void j_memory_chunk_free (JMemoryChunk *chunk)
 
gpointer j_memory_chunk_get (JMemoryChunk *chunk, guint64 length)
 
void j_memory_chunk_reset (JMemoryChunk *chunk)
 

Detailed Description

A chunk of memory intended for short time cashing of larger data chunks.

Typedef Documentation

◆ JMemoryChunk

typedef struct JMemoryChunk JMemoryChunk

Function Documentation

◆ j_memory_chunk_free()

void j_memory_chunk_free ( JMemoryChunk chunk)

Frees the memory allocated for the chunk.

JMemoryChunk* chunk;
...
j_memory_chunk_free(chunk);
Definition: jmemory-chunk.c:43
Parameters
chunkA chunk.

◆ j_memory_chunk_get()

gpointer j_memory_chunk_get ( JMemoryChunk chunk,
guint64  length 
)

Gets a new segment from the chunk.

JMemoryChunk* chunk;
...
j_memory_chunk_get(chunk, 1024);
Parameters
chunkA chunk.
lengthA length.
Returns
A pointer to a segment of the chunk, NULL if not enough space is available.

◆ j_memory_chunk_new()

JMemoryChunk * j_memory_chunk_new ( guint64  size)

Creates a new chunk.

JMemoryChunk* chunk;
chunk = j_memory_chunk_new(1024);
JMemoryChunk * j_memory_chunk_new(guint64 size)
Definition: jmemory-chunk.c:61
Parameters
sizeA size.
Returns
A new chunk. Should be freed with j_memory_chunk_free().

◆ j_memory_chunk_reset()

void j_memory_chunk_reset ( JMemoryChunk chunk)

Resets the given chunk. All data inside should be considered lost.

Parameters
chunkA chunk.