-
Marko Mäkelä authored
In InnoDB, the functions mem_alloc() and mem_free() are wrappers for mem_heap_alloc() and mem_heap_free(). They create an anonymous InnoDB memory heap for the single user object. Because the functions are defined inline, their invocation will generate quite a bit of code. It is questionable if there is any benefit of using mem_alloc() instead of ut_malloc(). There clearly is some CPU and memory overhead. The only possible benefit could be the extra debugging info, which is the subject of Bug#16924719 69422: small performance impact with heap block debugging info in release builds ut_malloc_low(): Remove the always-true parameter and rename to ut_malloc(). Remove ut_mem_null_ptr. Use a simple assertion also with the InnoDB memory heaps. ut_zalloc(): New function, to replace mem_zalloc(). mem_alloc(): Replace with ut_malloc(). mem_free(): Replace with ut_free(). mem_alloc2(): Replace with ut_malloc(). We will no longer determine the true allocated size of the block, but instead use the requested size only. os_mem_alloc_large(): Remove an #elif branch that contained non-compiling code. (The third argument of ut_malloc_low() had been removed a long time ago.) Do not check if the pointer is NULL before calling ut_free(), because ut_free() will check that. The caller-side check was needed for mem_free(). rb#3397 approved by Kevin Lewis
Marko Mäkelä authoredIn InnoDB, the functions mem_alloc() and mem_free() are wrappers for mem_heap_alloc() and mem_heap_free(). They create an anonymous InnoDB memory heap for the single user object. Because the functions are defined inline, their invocation will generate quite a bit of code. It is questionable if there is any benefit of using mem_alloc() instead of ut_malloc(). There clearly is some CPU and memory overhead. The only possible benefit could be the extra debugging info, which is the subject of Bug#16924719 69422: small performance impact with heap block debugging info in release builds ut_malloc_low(): Remove the always-true parameter and rename to ut_malloc(). Remove ut_mem_null_ptr. Use a simple assertion also with the InnoDB memory heaps. ut_zalloc(): New function, to replace mem_zalloc(). mem_alloc(): Replace with ut_malloc(). mem_free(): Replace with ut_free(). mem_alloc2(): Replace with ut_malloc(). We will no longer determine the true allocated size of the block, but instead use the requested size only. os_mem_alloc_large(): Remove an #elif branch that contained non-compiling code. (The third argument of ut_malloc_low() had been removed a long time ago.) Do not check if the pointer is NULL before calling ut_free(), because ut_free() will check that. The caller-side check was needed for mem_free(). rb#3397 approved by Kevin Lewis
Loading