mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
branches/zip: fix Mantis issue #74 Memory leak on Windows
The memory leak was due to wrong parameters passed into VirtualFree() call. So, the call fails with Windows error 87. MEM_DECOMMIT can NOT be used along with MEM_RELEASE. And if the parameter is MEM_RELEASE, the size parameter must be 0. The function frees the entire region that is reserved in the initial allocation call to VirtualAlloc. This issue was introduced by r984. Approved by: Heikki (on IM)
This commit is contained in:
parent
d36b83e65b
commit
ad51dcb5af
1 changed files with 3 additions and 1 deletions
|
@ -186,7 +186,9 @@ os_mem_free_large(
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LARGE_PAGES && UNIV_LINUX */
|
#endif /* HAVE_LARGE_PAGES && UNIV_LINUX */
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
if (!VirtualFree(ptr, size, MEM_DECOMMIT | MEM_RELEASE)) {
|
/* When RELEASE memory, the size parameter must be 0.
|
||||||
|
Do not use MEM_RELEASE with MEM_DECOMMIT. */
|
||||||
|
if (!VirtualFree(ptr, 0, MEM_RELEASE)) {
|
||||||
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());
|
||||||
|
|
Loading…
Add table
Reference in a new issue