diff --git a/ide/vs2017/mimalloc-test-stress.vcxproj b/ide/vs2017/mimalloc-test-stress.vcxproj
new file mode 100644
index 00000000..5ef92d86
--- /dev/null
+++ b/ide/vs2017/mimalloc-test-stress.vcxproj
@@ -0,0 +1,155 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 15.0
+ {FEF7958F-750E-4C21-A04D-22707CC66878}
+ mimalloc-test-stress
+ 10.0.17134.0
+ mimalloc-test-stress
+
+
+
+ Application
+ true
+ v141
+
+
+ Application
+ false
+ v141
+ true
+
+
+ Application
+ true
+ v141
+
+
+ Application
+ false
+ v141
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+
+
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+
+
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+
+
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\
+
+
+
+ Level3
+ Disabled
+ true
+ true
+ ..\..\include
+
+
+ Console
+
+
+
+
+ Level3
+ Disabled
+ true
+ true
+ ..\..\include
+
+
+ Console
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ true
+ ..\..\include
+ %(PreprocessorDefinitions);NDEBUG
+
+
+ true
+ true
+ Console
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ true
+ ..\..\include
+ %(PreprocessorDefinitions);NDEBUG
+
+
+ true
+ true
+ Console
+
+
+
+
+
+
+
+
+ {abb5eae7-b3e6-432e-b636-333449892ea6}
+
+
+
+
+
+
diff --git a/ide/vs2017/mimalloc-test-stress.vcxproj.filters b/ide/vs2017/mimalloc-test-stress.vcxproj.filters
new file mode 100644
index 00000000..b857ea52
--- /dev/null
+++ b/ide/vs2017/mimalloc-test-stress.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+
diff --git a/ide/vs2017/mimalloc.sln b/ide/vs2017/mimalloc.sln
index f4860d93..aeab6b88 100644
--- a/ide/vs2017/mimalloc.sln
+++ b/ide/vs2017/mimalloc.sln
@@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc-override", "mimall
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc-override-test", "mimalloc-override-test.vcxproj", "{FEF7868F-750E-4C21-A04D-22707CC66879}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc-test-stress", "mimalloc-test-stress.vcxproj", "{FEF7958F-750E-4C21-A04D-22707CC66878}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -51,6 +53,14 @@ Global
{FEF7868F-750E-4C21-A04D-22707CC66879}.Release|x64.Build.0 = Release|x64
{FEF7868F-750E-4C21-A04D-22707CC66879}.Release|x86.ActiveCfg = Release|Win32
{FEF7868F-750E-4C21-A04D-22707CC66879}.Release|x86.Build.0 = Release|Win32
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Debug|x64.ActiveCfg = Debug|x64
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Debug|x64.Build.0 = Debug|x64
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Debug|x86.ActiveCfg = Debug|Win32
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Debug|x86.Build.0 = Debug|Win32
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Release|x64.ActiveCfg = Release|x64
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Release|x64.Build.0 = Release|x64
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Release|x86.ActiveCfg = Release|Win32
+ {FEF7958F-750E-4C21-A04D-22707CC66878}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/test/test-stress.c b/test/test-stress.c
index 11a66a82..6afde306 100644
--- a/test/test-stress.c
+++ b/test/test-stress.c
@@ -19,11 +19,11 @@ terms of the MIT license. A copy of the license can be found in the file
#include "mimalloc-internal.h"
#include "mimalloc-atomic.h"
-const size_t N = 10; // scaling factor
-const size_t THREADS = 32;
+#define N (10) // scaling factor
+#define THREADS (32)
+#define TRANSFERS (1000)
-#define transfer_size (1000)
-static volatile void* transfer[transfer_size];
+static volatile void* transfer[TRANSFERS];
#if (MI_INTPTR_SIZE==8)
const uintptr_t cookie = 0xbf58476d1ce4e5b9UL;
@@ -90,7 +90,7 @@ static void stress(intptr_t tid) {
if ((tid%2)==0 && (rand()%4)==0 && data_top > 0) {
// 25% transfer-swap of half the threads
size_t data_idx = rand() % data_top;
- size_t transfer_idx = rand() % transfer_size;
+ size_t transfer_idx = rand() % TRANSFERS;
void* p = data[data_idx];
void* q = mi_atomic_exchange_ptr(&transfer[transfer_idx],p);
data[data_idx] = q;
@@ -111,9 +111,9 @@ static void run_os_threads();
int main() {
srand(42);
- memset(transfer,0,transfer_size*sizeof(void*));
+ memset((void*)transfer,0,TRANSFERS*sizeof(void*));
run_os_threads();
- for (int i = 0; i < transfer_size; i++) {
+ for (int i = 0; i < TRANSFERS; i++) {
free_items((void*)transfer[i]);
}
mi_collect(false);