Issue 26474: ctypes: Memory leak at malloc_closure.c (original) (raw)

malloc_closere.c holds a static list of items: free_list. The items are being allocated in the more_core method using VirtualAlloc / mmap. However they never get released.

Here is the allocation code:

#ifdef MS_WIN32 item = (ITEM *)VirtualAlloc(NULL, count * sizeof(ITEM), MEM_COMMIT, PAGE_EXECUTE_READWRITE); if (item == NULL) return; #else item = (ITEM *)mmap(NULL, count * sizeof(ITEM), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (item == (void *)MAP_FAILED) return; #endif