Memory Allocation

G-Golf Glib Memory Allocation low level API.
Memory Allocation — general memory-handling

Procedures

g-malloc
g-malloc0
g-free
g-memdup

Description

These functions provide support for allocating and freeing memory.

Please read the Memory Allocation section from the Glib reference manual for a complete description.

Procedures

Procedure: g-malloc n-bytes
Procedure: g-malloc0 n-bytes

Returns a pointer to the allocated memory, or #f.

Allocates n-bytes of memory. If n-bytes is 0 it returns #f. When using g-malloc0, the allocated memory is initialized to 0.

Procedure: g-free mem

Returns nothing.

Frees the memory pointed to by mem.

Procedure: g-memdup mem n-bytes

Returns a pointer to the allocated memory, or #f.

Allocates n-bytes of memory and copies n-bytes into it from mem. If mem is the %null-pointer or n-bytes is 0 it returns #f.