Hi,
I have read the gdk_heap code in detail to understand whether MonetDB reuses the same virtual address range over and over again for multiple allocations. From my analyses, I found out the following:
1)
HEAPalloc is used for memory allocation. If requested size is under GDK_mmap_minsize then STORE_MEM (GDKmalloc|malloc) is used for allocation Otherwise STORE_MMAP (anonymous mmap) or STORE_PRIV (DISK mmap) is used
2)
HEAPfree use HEAPcacheAdd to return the previously allocated virtual address space to the cache whose size is fixed at 5 elements. So this means only these 5 address ranges will be used over time and their size would be extended using
HEAPextend
3)
Apart from those 5 HEAPcache entries, MonetDB doesn’t use any reallocation of same virtual address range for multiple objects but just relies on operating system to handle the allocation and de-allocation through malloc/mmap. Does this
mean that MonetDB just keeps only 5 HEAPcache entries to reduce the overhead of mmap calls and manage those virtual addresses by itself for future allocations? [HEAP_CACHE_SIZE = 5]
I understand that this is very simplistic analyses of what MonetDB actually does in gdk_heap but any information on the gdk_heap would be really helpful.
Thanks.
Kind Regards, Ahmad