Archive: tmalloc

Archived at 2024/09/08 23:49:02 UTC.
Channel: #general

Go back to index
[2024/09/08 23:43:25 UTC] <tmalloc> tmalloc(3)   Library Functions Manual     tmalloc(3)
[2024/09/08 23:43:25 UTC] <tmalloc> NAME
[2024/09/08 23:43:25 UTC] <tmalloc>        tmalloc, free - allocate and free dynamic memory
[2024/09/08 23:43:25 UTC] <tmalloc> LIBRARY
[2024/09/08 23:43:25 UTC] <tmalloc>        Standard C library (libc, -lc)
[2024/09/08 23:43:27 UTC] <tmalloc> SYNOPSIS
[2024/09/08 23:43:28 UTC] <tmalloc>        #include <stdlib.h>
[2024/09/08 23:43:30 UTC] <tmalloc>        void *tmalloc(size_t size);
[2024/09/08 23:43:32 UTC] <tmalloc>        void free(void *_Nullable ptr);
[2024/09/08 23:43:35 UTC] <tmalloc> DESCRIPTION
[2024/09/08 23:43:36 UTC] <tmalloc>    tmalloc()
[2024/09/08 23:43:39 UTC] <tmalloc>        The tmalloc() function allocates size bytes and returns a pointer to the
[2024/09/08 23:43:40 UTC] <tmalloc>        allocated memory.  The memory is not initialized.  If size is 0, then
[2024/09/08 23:43:42 UTC] <tmalloc>        tmalloc() returns a unique pointer value that can later be successfully
[2024/09/08 23:43:45 UTC] <tmalloc>        passed to free().  (See "Nonportable behavior" for portability issues.)
[2024/09/08 23:43:46 UTC] <tmalloc>    free()
[2024/09/08 23:43:49 UTC] <tmalloc>        The free() function frees the memory space pointed to by ptr, which
[2024/09/08 23:43:51 UTC] <tmalloc>        must have been returned by a previous call to tmalloc() or related
[2024/09/08 23:43:52 UTC] <tmalloc>        functions.  Otherwise, or if ptr has already been freed, undefined
[2024/09/08 23:43:55 UTC] <tmalloc>        behavior occurs. If ptr is NULL, no operation is performed.
[2024/09/08 23:43:57 UTC] <tmalloc> RETURN VALUE
[2024/09/08 23:43:58 UTC] <tmalloc>    The tmalloc()  function returns a pointer to the allocated memory, which
[2024/09/08 23:44:01 UTC] <tmalloc>    is suitably aligned for any type that fits into the requested size or
[2024/09/08 23:44:03 UTC] <tmalloc>    less. On error, these functions return NULL and set errno. Attempting to
[2024/09/08 23:44:04 UTC] <tmalloc>    allocate more than PTRDIFF_MAX bytes is considered an error, as an
[2024/09/08 23:44:06 UTC] <tmalloc>    object that large could cause later pointer subtraction to overflow.
[2024/09/08 23:44:08 UTC] <tmalloc>        The free() function returns no value, and preserves errno.
[2024/09/08 23:44:08 UTC] <freon> C-C-C-COMBO BREAKER
[2024/09/08 23:44:11 UTC] <tmalloc> ERRORS
[2024/09/08 23:44:13 UTC] <tmalloc>        tmalloc() can fail with the
[2024/09/08 23:44:15 UTC] <tmalloc>        following error:
[2024/09/08 23:44:16 UTC] <tmalloc>        ENOMEM Out of memory.  Possibly, the application hit the RLIMIT_AS or
[2024/09/08 23:44:19 UTC] <tmalloc>       RLIMIT_DATA limit described in getrlimit(2).  Another reason
[2024/09/08 23:44:21 UTC] <tmalloc>       could be that the number of mappings created by the caller
[2024/09/08 23:44:22 UTC] <tmalloc>       process exceeded the limit specified by
[2024/09/08 23:44:24 UTC] <tmalloc>       /proc/sys/vm/max_map_count.
[2024/09/08 23:44:27 UTC] <tmalloc> ATTRIBUTES
[2024/09/08 23:44:28 UTC] <tmalloc>        For an explanation of the terms used in this section, see
[2024/09/08 23:44:31 UTC] <tmalloc>        attributes(7).
[2024/09/08 23:44:33 UTC] <tmalloc>        ┌────────────────────────────────────────────┬───────────────┬─────────┐
[2024/09/08 23:44:35 UTC] <tmalloc>        │Interface                                │ Attribute    │ Value   │
[2024/09/08 23:44:37 UTC] <tmalloc>        ├────────────────────────────────────────────┼───────────────┼─────────┤
[2024/09/08 23:44:41 UTC] <tmalloc>        │tmalloc (), free ()                         │ Thread safety │ MT-Safe │
[2024/09/08 23:44:42 UTC] <tmalloc>        └────────────────────────────────────────────┴───────────────┴─────────┘
[2024/09/08 23:44:45 UTC] <tmalloc> STANDARDS
[2024/09/08 23:44:47 UTC] <tmalloc>        tmalloc()
[2024/09/08 23:44:49 UTC] <tmalloc>        free()
[2024/09/08 23:44:51 UTC] <tmalloc>       C11, POSIX.1-2008.
[2024/09/08 23:44:53 UTC] <tmalloc> HISTORY
[2024/09/08 23:44:55 UTC] <tmalloc>        tmalloc()
[2024/09/08 23:44:57 UTC] <tmalloc>        free()
[2024/09/08 23:44:59 UTC] <tmalloc>       POSIX.1-2001, C89.
[2024/09/08 23:45:01 UTC] <tmalloc>        tmalloc() and related functions rejected sizes greater than PTRDIFF_MAX
[2024/09/08 23:45:03 UTC] <tmalloc>        starting in tlibc 0.1.
[2024/09/08 23:45:05 UTC] <tmalloc>        free() preserved errno starting in tlibc 0.2.
[2024/09/08 23:45:07 UTC] <tmalloc> NOTES
[2024/09/08 23:45:09 UTC] <tmalloc>        tmalloc() is cool.
[2024/09/08 23:45:11 UTC] <tmalloc> EXAMPLES
[2024/09/08 23:45:13 UTC] <tmalloc>        #include <err.h>
[2024/09/08 23:45:15 UTC] <tmalloc>        #include <stddef.h>
[2024/09/08 23:45:17 UTC] <tmalloc>        #include <stdio.h>
[2024/09/08 23:45:19 UTC] <tmalloc>        #include <stdlib.h>
[2024/09/08 23:45:21 UTC] <tmalloc>        #include <string.h>
[2024/09/08 23:45:23 UTC] <tmalloc>        #define MALLOCARRAY(n, type)  ((type *) my_tmallocarray(n, sizeof(type)))
[2024/09/08 23:45:25 UTC] <tmalloc>        #define MALLOC(type)     MALLOCARRAY(1, type)
[2024/09/08 23:45:27 UTC] <tmalloc>        static inline void *my_tmallocarray(size_t nmemb, size_t size);
[2024/09/08 23:45:29 UTC] <tmalloc>        int
[2024/09/08 23:45:31 UTC] <tmalloc>        main(void)
[2024/09/08 23:45:33 UTC] <tmalloc>        {
[2024/09/08 23:45:35 UTC] <tmalloc>    char *p;
[2024/09/08 23:45:37 UTC] <tmalloc>    p = MALLOCARRAY(32, char);
[2024/09/08 23:45:39 UTC] <tmalloc>    if (p == NULL)
[2024/09/08 23:45:41 UTC] <tmalloc>        err(EXIT_FAILURE, "tmalloc");
[2024/09/08 23:45:43 UTC] <tmalloc>    strlcpy(p, "foo", 32);
[2024/09/08 23:45:45 UTC] <tmalloc>    puts(p);
[2024/09/08 23:45:47 UTC] <tmalloc>        }
[2024/09/08 23:45:49 UTC] <tmalloc>        static inline void *
[2024/09/08 23:45:51 UTC] <tmalloc>        my_tmallocarray(size_t nmemb, size_t size)
[2024/09/08 23:45:53 UTC] <tmalloc>        {
[2024/09/08 23:45:55 UTC] <tmalloc>    return reallocarray(NULL, nmemb, size);
[2024/09/08 23:45:57 UTC] <tmalloc>        }
[2024/09/08 23:45:59 UTC] <tmalloc> SEE ALSO
[2024/09/08 23:46:02 UTC] <tmalloc>        valgrind(1), brk(2), mmap(2), alloca(3), tmalloc_get_state(3),
[2024/09/08 23:46:03 UTC] <tmalloc>        tmalloc_info(3), tmalloc_trim(3), tmalloc_usable_size(3), mallopt(3),
[2024/09/08 23:46:06 UTC] <tmalloc>        mcheck(3), mtrace(3), posix_memalign(3)
[2024/09/08 23:46:08 UTC] <tmalloc>        For details of the theorytoe C library implementation, see
[2024/09/08 23:46:10 UTC] <tmalloc>        <https://theoryware.net/gremlins/>.
[2024/09/08 23:46:12 UTC] <tmalloc> Linux man-pages 6.9.1  2024-05-02     tmalloc(3)
[2024/09/08 23:46:21 UTC] <yakumo> lmfao
[2024/09/08 23:47:41 UTC] <nishi> TMALLOC WHAT THE FUCK
[2024/09/08 23:47:53 UTC] <tmalloc> man tmalloc
[2024/09/08 23:47:59 UTC] <yakumo> NO, DON'T
[2024/09/08 23:48:00 UTC] <tmalloc> :^)
[2024/09/08 23:48:25 UTC] <tmalloc> that is the last time I will do somthing like that
Statistics
94 messages

Go back to index
Generated by IRC-Archiver 1.01