Commit c9b221e8 authored by marko's avatar marko

branches/zip: os_mem_alloc_large(), os_mem_free_large():

Update ut_total_allocated_memory.
parent 66791e5a
...@@ -109,6 +109,7 @@ os_mem_alloc_large( ...@@ -109,6 +109,7 @@ os_mem_alloc_large(
if (ptr) { if (ptr) {
*n = size; *n = size;
ut_total_allocated_memory += size;
# ifdef UNIV_SET_MEM_TO_ZERO # ifdef UNIV_SET_MEM_TO_ZERO
memset(ptr, '\0', size); memset(ptr, '\0', size);
# endif # endif
...@@ -133,8 +134,9 @@ skip: ...@@ -133,8 +134,9 @@ skip:
fprintf(stderr, "InnoDB: VirtualAlloc(%lu bytes) failed;" fprintf(stderr, "InnoDB: VirtualAlloc(%lu bytes) failed;"
" Windows error %lu\n", " Windows error %lu\n",
(ulong) size, (ulong) GetLastError()); (ulong) size, (ulong) GetLastError());
} else {
ut_total_allocated_memory += size;
} }
#elif defined __NETWARE__ || !defined OS_MAP_ANON #elif defined __NETWARE__ || !defined OS_MAP_ANON
size = *n; size = *n;
ptr = ut_malloc_low(size, TRUE, FALSE); ptr = ut_malloc_low(size, TRUE, FALSE);
...@@ -153,6 +155,8 @@ skip: ...@@ -153,6 +155,8 @@ skip:
" errno %lu\n", " errno %lu\n",
(ulong) size, (ulong) errno); (ulong) size, (ulong) errno);
ptr = NULL; ptr = NULL;
} else {
ut_total_allocated_memory += size;
} }
#endif #endif
return(ptr); return(ptr);
...@@ -169,8 +173,11 @@ os_mem_free_large( ...@@ -169,8 +173,11 @@ os_mem_free_large(
ulint size) /* in: size returned by ulint size) /* in: size returned by
os_mem_alloc_large() */ os_mem_alloc_large() */
{ {
ut_a(ut_total_allocated_memory >= size);
#if defined HAVE_LARGE_PAGES && defined UNIV_LINUX #if defined HAVE_LARGE_PAGES && defined UNIV_LINUX
if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) { if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) {
ut_total_allocated_memory -= size;
return; return;
} }
#endif /* HAVE_LARGE_PAGES && UNIV_LINUX */ #endif /* HAVE_LARGE_PAGES && UNIV_LINUX */
...@@ -179,6 +186,8 @@ os_mem_free_large( ...@@ -179,6 +186,8 @@ os_mem_free_large(
fprintf(stderr, "InnoDB: VirtualFree(%p, %lu) failed;" fprintf(stderr, "InnoDB: VirtualFree(%p, %lu) failed;"
" Windows error %lu\n", " Windows error %lu\n",
ptr, (ulong) size, (ulong) GetLastError()); ptr, (ulong) size, (ulong) GetLastError());
} else {
ut_total_allocated_memory -= size;
} }
#elif defined __NETWARE__ || !defined OS_MAP_ANON #elif defined __NETWARE__ || !defined OS_MAP_ANON
ut_free(ptr); ut_free(ptr);
...@@ -187,8 +196,9 @@ os_mem_free_large( ...@@ -187,8 +196,9 @@ os_mem_free_large(
fprintf(stderr, "InnoDB: munmap(%p, %lu) failed;" fprintf(stderr, "InnoDB: munmap(%p, %lu) failed;"
" errno %lu\n", " errno %lu\n",
ptr, (ulong) size, (ulong) errno); ptr, (ulong) size, (ulong) errno);
} else {
ut_total_allocated_memory -= size;
} }
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment