MCPcopy Create free account
hub / github.com/acl-dev/acl / malloc

Function malloc

test/libmm/libmm.cpp:51–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void *malloc(size_t size)
52{
53 void *ptr;
54
55 pthread_once(&once_control, once_init);
56
57 if (size == (size_t) -1) {
58 __check = true;
59 pthread_mutex_lock(&__lock);
60 total_size = 0;
61 pthread_mutex_unlock(&__lock);
62 printf("check started!\r\n");
63 return NULL;
64 }
65 if (size == 0) {
66 __check = false;
67 printf("check stopped!\r\n");
68 return NULL;
69 }
70
71 ptr = mymalloc(size);
72 if (ptr && __check) {
73 if (size == 8208) {
74 //abort();
75 }
76
77 if (1) {
78 printf("---------------------------------------\r\n");
79 stacktrace();
80 }
81
82 pthread_mutex_lock(&__lock);
83 total_size += size;
84 pthread_mutex_unlock(&__lock);
85 printf(">>>malloc ptr=%p, size=%zd, total=%zd\r\n",
86 ptr, size, total_size);
87 printf("\r\n");
88 }
89
90 return ptr;
91}

Callers 15

client_echoFunction · 0.85
run_poolFunction · 0.85
run_ipcFunction · 0.85
client_readFunction · 0.85
fiber_connectFunction · 0.85
main.cFile · 0.85
main.cFile · 0.85
test2Function · 0.85
mainFunction · 0.85
main.cFile · 0.85
mainFunction · 0.85
fiber_acceptFunction · 0.85

Calls 5

pthread_onceFunction · 0.85
pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85
mymallocFunction · 0.85
stacktraceFunction · 0.85

Tested by 8

fiber_acceptFunction · 0.68
fiber_readerFunction · 0.68
fiber_clientFunction · 0.68
fiber_acceptFunction · 0.68
fiber_readerFunction · 0.68
fiber_writerFunction · 0.68
echo_clientFunction · 0.68
test_tls_threadFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…