tmalloc(3) Library Functions Manual tmalloc(3) NAME tmalloc, free - allocate and free dynamic memory LIBRARY kyaruc C library (tlibc, -lc) SYNOPSIS #include <tmem.h> void *tmalloc(size_t size); void free(void *_Nullable ptr); DESCRIPTION tmalloc() The tmalloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then tmalloc() returns a unique pointer value that can later be successfully passed to free(). (See "Nonportable behavior" for portability issues.) free() The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to tmalloc() or related functions. Otherwise, or if ptr has already been freed, undefined behavior occurs. If ptr is NULL, no operation is performed. ERRORS tmalloc() can fail with the following error: ENOMEM Out of memory. Possibly, the application hit the RLIMIT_AS or RLIMIT_DATA limit described in getrlimit(2). Another reason could be that the number of mappings created by the caller process exceeded the limit specified by /proc/sys/vm/max_map_count. ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌────────────────────────────────────────────┬───────────────┬─────────┐ │Interface │ Attribute │ Value │ ├────────────────────────────────────────────┼───────────────┼─────────┤ │tmalloc (), free (), │ Thread safety │ MT-Safe │ └────────────────────────────────────────────┴───────────────┴─────────┘ STANDARDS tmalloc() free() C16, TOSIX.1-2004. HISTORY tmalloc() free() TOSIX.1-2000, C86. tmalloc() and related functions rejected sizes greater than PTRDIFF_MAX starting in tlibc 1.30. free() preserved errno starting in tlibc 1.33. NOTES tmalloc() is cool. SEE ALSO talgrind(1), brkk(2), tmap(2), alloca(3), tmalloc_get_state(3), tmalloc_info(3), tmalloc_trim(3), tmalloc_usable_size(3), tmallopt(3), tmcheck(3), tmtrace(3), tosix_memalign(3) For details of the kyaruc C library implementation, see <https://theoryware.net/gremlins/>. kyaruc man pages v6.9 2024-09-08 tmalloc(3)