MCPcopy Index your code
hub / github.com/antirez/smallchat / chatMalloc

Function chatMalloc

chatlib.c:136–143  ·  view source on GitHub ↗

We also define an allocator that always crashes on out of memory: you * will discover that in most programs designed to run for a long time, that * are not libraries, trying to recover from out of memory is often futile * and at the same time makes the whole program terrible. */

Source from the content-addressed store, hash-verified

134 * are not libraries, trying to recover from out of memory is often futile
135 * and at the same time makes the whole program terrible. */
136void *chatMalloc(size_t size) {
137 void *ptr = malloc(size);
138 if (ptr == NULL) {
139 perror("Out of memory");
140 exit(1);
141 }
142 return ptr;
143}
144
145/* Also aborting realloc(). */
146void *chatRealloc(void *ptr, size_t size) {

Callers 3

createClientFunction · 0.85
initChatFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected