MCPcopy Create free account
hub / github.com/3proxy/3proxy / myalloc64k

Function myalloc64k

src/myalloc.c:61–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void * myalloc64k(){
62
63 struct mempage *newpage;
64
65 if(!mem_init)init_mem();
66 if(!(newpage = (struct mempage *)malloc(sizeof(struct mempage)))){
67#if DEBUGLEVEL > 0
68fprintf(stderr, "Failed to allocate p64k\n");
69fflush(stderr);
70#endif
71 return NULL;
72 }
73 memset(newpage->bitmap, 0, 32);
74 newpage->usable = 0;
75 pthread_mutex_lock(&mem_mutex);
76 newpage->next = pages[p64k];
77 pages[p64k] = newpage;
78 pthread_mutex_unlock(&mem_mutex);
79#if DEBUGLEVEL > 2
80fprintf(stderr, "New p64k created, address %X region: %X\n", newpage, newpage->data);
81fflush(stderr);
82#endif
83#if DEBUGLEVEL == 2
84fprintf(stderr, "myalloc64 %p\n", newpage->data);
85fflush(stderr);
86#endif
87
88 return newpage->data;
89}
90
91int alloced = 0;
92

Callers 1

myallocFunction · 0.85

Calls 1

init_memFunction · 0.85

Tested by

no test coverage detected