@c -*-texinfo-*-
@c This is part of the GNU G-Golf Reference Manual.
@c Copyright (C) 2016 - 2020 Free Software Foundation, Inc.
@c See the file g-golf.texi for copying conditions.


@c @defindex tl


@node Memory Allocation
@subsection Memory Allocation

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


@subheading Procedures

@indentedblock
@table @code
@item @ref{g-malloc}
@item @ref{g-malloc0}
@item @ref{g-free}
@item @ref{g-memdup}
@end table
@end indentedblock


@c @subheading Types and Values

@c @indentedblock
@c @table @code
@c @item @ref{<gi-enum>}
@c @end table
@c @end indentedblock


@c @subheading Struct Hierarchy

@c @indentedblock
@c GIBaseInfo           	       		@*
@c @ @ +--- GIRegisteredTypeInfo  		@*
@c @ @ @ @ @ @ @ @ @ @ @  +--- GIEnumInfo
@c @end indentedblock


@subheading Description
These functions provide support for allocating and freeing memory.

Please read the @uref{@value{UGLIB-Mem-Alloc}, Memory Allocation}
section from the Glib reference manual for a complete description.


@subheading Procedures

@anchor{g-malloc}
@anchor{g-malloc0}
@deffn Procedure g-malloc n-bytes
@deffnx Procedure g-malloc0 n-bytes

Returns a pointer to the allocated memory, or @code{#f}.

Allocates @var{n-bytes} of memory. If @var{n-bytes} is @code{0} it
returns @code{#f}.  When using @code{g-malloc0}, the allocated memory is
initialized to @code{0}.
@end deffn


@anchor{g-free}
@deffn Procedure g-free mem

Returns nothing.

Frees the memory pointed to by mem.
@end deffn


@anchor{g-memdup}
@deffn Procedure g-memdup mem n-bytes

Returns a pointer to the allocated memory, or @code{#f}.

Allocates @var{n-bytes} of memory and copies @var{n-bytes} into it from
@var{mem}. If @var{mem} is the @code{%null-pointer} or @var{n-bytes} is
@code{0} it returns @code{#f}.
@end deffn


@c @subheading Types and Values
