heap_avail()

Purpose

Determines the size of the largest block in the heap or whether mallocx() will succeed

Syntax

size_t heap_avail(size_t size);

Parameters

size_t size

size of the heap block required

Description

This function has two modes of operation.

  • If the size is not 0, heap_avail() returns the size if a corresponding request to mallocx() can be satisfied or, if it cannot be satisfied, the size of the largest block of free memory (which may be larger).
  • If the size is 0, the size of the largest memory block is returned

Return values

The size of memory block asked for or the largest memory block