From ee99b82f45cb3f6764dc499c01379150e3c0beec Mon Sep 17 00:00:00 2001 From: Enrico Giordani Date: Wed, 15 Jul 2015 13:57:17 +0200 Subject: [PATCH] [Fix] Memory was not properly released at the end of the memory test. [Change] Hard-coded memory test loops changed from 50 to 5. [Setup] Updated the release notes. --- Redis on Windows Release Notes.md | 16 ++++++++++++++++ src/memtest.c | 4 ++++ src/redis.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Redis on Windows Release Notes.md b/Redis on Windows Release Notes.md index 0f186bf3d2f..a5ad0f82999 100644 --- a/Redis on Windows Release Notes.md +++ b/Redis on Windows Release Notes.md @@ -5,6 +5,20 @@ MSOpenTech Redis on Windows 2.8 Release Notes - [Fix] deleting char** correctly (@zeliard) - [Fix] Fork code for background processing fixes and code refactoring. + - [Fix] BeginForkOperation_Aof()/_Rdb()/_Socket() and BeginForkOperation() code + refactoring. + - [Fix] rewriteAppendOnlyFileBackground() code refactoring to minimize the code + changes for WIN32. + -[Fix] rewriteAppendOnlyFileBackground() must update the latency monitor, the + fork stats and replicationScriptCacheFlush(). + - [Fix] rdbSaveBackground() code refactoring to minimize the code changes for + WIN32. + - [Fix] rdbSaveBackground() must update the latency monitor and the fork stats. + - [Fix] memory leak in rdbSaveToSlavesSockets(). + - [Fix] properly releasing resources in rdbSaveToSlavesSockets(). + - [Fix] QForkChildInit() not setting the operationFailed event in case of + exception. + - [Fix] QForkChildInit() AV in catch() statement. - [Setup] Updated the scripts to create/push the NuGet/Chocolatey packages. - [Setup] EventLog.dll excluded from NuGet package. - [Fix] The stack trace was not logged when Redis is running as a service. @@ -29,6 +43,8 @@ MSOpenTech Redis on Windows 2.8 Release Notes - [Setup] Updated the release number and the release notes (2.8.2101). - [Fix] Bug report fixes. - [Setup] Nuget/Chocolatey packages update. + - [Fix] Memory was not properly released at the end of the memory test. + - [Change] Hard-coded memory test loops changed from 50 to 5. --[ Redis on Windows 2.8.21 ] Release date: Jun 24 2015 diff --git a/src/memtest.c b/src/memtest.c index f361d88e3e4..63486c0217a 100644 --- a/src/memtest.c +++ b/src/memtest.c @@ -267,7 +267,11 @@ void memtest_test(size_t megabytes, int passes) { memtest_progress_end(); memtest_compare_times(m,bytes,pass,4); } +#ifdef _WIN32 + VirtualFreeEx(GetCurrentProcess(), m, 0, MEM_RELEASE); +#else free(m); +#endif } void memtest_non_destructive_invert(void *addr, size_t size) { diff --git a/src/redis.c b/src/redis.c index 45af41bac6a..902e9e6d15a 100644 --- a/src/redis.c +++ b/src/redis.c @@ -3449,7 +3449,7 @@ int main(int argc, char **argv) { strcmp(argv[1], "-h") == 0) usage(); if (strcmp(argv[1], "--test-memory") == 0) { if (argc == 3) { - memtest(atoi(argv[2]),50); + memtest(atoi(argv[2]),IF_WIN32(5,50)); exit(0); } else { fprintf(stderr,"Please specify the amount of memory to test in megabytes.\n");