+/****f* silcutil/SilcStackAPI/silc_stack_malloc
+ *
+ * SYNOPSIS
+ *
+ * void *silc_stack_malloc(SilcStack stack, SilcUInt32 size);
+ *
+ * DESCRIPTION
+ *
+ * Low level memory allocation routine. Allocates memory block of size of
+ * `size' from the `stack'. The allocated memory is aligned so it can be
+ * used to allocate memory for structures, for example. Returns the
+ * allocated memory address or NULL if memory could not be allocated from
+ * the `stack'.
+ *
+ * NOTES
+ *
+ * This function should be used only if low level memory allocation with
+ * SilcStack is needed. Instead, silc_smalloc and silc_scalloc could
+ * be used.
+ *
+ ***/
+void *silc_stack_malloc(SilcStack stack, SilcUInt32 size);
+
+/****f* silcutil/SilcStackAPI/silc_stack_realloc
+ *
+ * SYNOPSIS
+ *
+ * void *silc_stack_realloc(SilcStack stack, SilcUInt32 old_size,
+ * void *ptr, SilcUInt32 size);
+ *
+ * DESCRIPTION
+ *
+ * Attempts to reallocate memory by changing the size of the `ptr' into
+ * `size'. This routine works only if the previous allocation to `stack'
+ * was `ptr'. If there is another memory allocation between allocating
+ * `ptr' and this call this routine will return NULL (and silc_errno is
+ * set to SILC_ERR_INVALID_ARGUMENT). NULL is also returned if the `size'
+ * does not fit into the current stack block. If NULL is returned the old
+ * memory remains intact.
+ *
+ * NOTES
+ *
+ * This function should be used only if low level memory allocation with
+ * SilcStack is needed. Instead, silc_srealloc could be used.
+ *
+ ***/
+void *silc_stack_realloc(SilcStack stack, SilcUInt32 old_size,
+ void *ptr, SilcUInt32 size);
+
+/****f* silcutil/SilcStackAPI/silc_stack_set_oom_handler
+ *
+ * SYNOPSIS
+ *
+ * void silc_stack_set_oom_handler(SilcStack stack,
+ * SilcStackOomHandler oom_handler,
+ * void *context);
+ *
+ * DESCRIPTION
+ *
+ * Sets Out of Memory handler `oom_handler' to `stack' to be called
+ * if memory allocation from `stack' fails. The `context' is delivered
+ * to `oom_handler'.
+ *
+ * Usually Out of Memory handler is set only when failed memory allocation
+ * is a fatal error. In this case the application would abort() inside
+ * the `oom_handler'. It may also be set if in case of failed allocation
+ * application wants to do clean up properly.
+ *
+ ***/
+void silc_stack_set_oom_handler(SilcStack stack,
+ SilcStackOomHandler oom_handler,
+ void *context);
+
+/****f* silcutil/SilcStackAPI/silc_stack_set_alignment
+ *
+ * SYNOPSIS
+ *
+ * void silc_stack_set_alignment(SilcStack stack, SilcUInt32 alignment);
+ *
+ * DESCRIPTION
+ *
+ * Sets/changes the memory alignment in the `stack' to `alignment' which
+ * is the alignment in bytes. By default, the SilcStack will use alignment
+ * suited for the platform where it is used. This function can be used
+ * to change this alignment, if such change is needed. You may check the
+ * current alignment by calling silc_stack_get_alignment.
+ *
+ * NOTES
+ *
+ * It is not mandatory to call this function. By default the SilcStack
+ * will always use alignment suited for the used platform. This function
+ * should be called only if the alignment needs to be changed to something
+ * other than the default on the used platform. For example, some
+ * hardware device, such as crypto accelerator, may require special
+ * alignment.
+ *
+ ***/
+void silc_stack_set_alignment(SilcStack stack, SilcUInt32 alignment);
+
+/****f* silcutil/SilcStackAPI/silc_stack_get_alignment
+ *
+ * SYNOPSIS
+ *
+ * SilcUInt32 silc_stack_get_alignment(SilcStack stack);
+ *
+ * DESCRIPTION
+ *
+ * Returns the memory alignment used with `stack'. The alignment is in
+ * bytes.
+ *
+ ***/
+SilcUInt32 silc_stack_get_alignment(SilcStack stack);
+
+/****f* silcutil/SilcStackAPI/silc_stack_purge
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_stack_purge(SilcStack stack);
+ *
+ * DESCRIPTION
+ *
+ * Purges the `stack' from extra unused memory. This purges only `stack'
+ * and not its parent if `stack' is a child. This purges only large
+ * allocations. The 1024, 2048, 4096 and 8192 bytes of allocations remain.
+ * Call this multiple times to purge even more. Returns FALSE when there
+ * is no more to purge. This does not purge memory blocks that currently
+ * have allocations. No memory allocations from the stack are lost, so
+ * this is always safe to call.
+ *
+ ***/
+SilcBool silc_stack_purge(SilcStack stack);
+