#include
#include
using namespace std;
int main()
{
vector< vector > dp(50000, vector(4, -1));
c
It's definitely HeapFree that's slowing this down, you can get the same effect with the program below.
Passing parameters like HEAP_NO_SERIALIZE to HeapFree doesn't help either.
#include "stdafx.h"
#include
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE heap = HeapCreate(0, 0, 0);
void** pointers = new void*[50000];
int i = 0;
for (i = 0; i < 50000; ++i)
{
pointers[i] = HeapAlloc(heap, 0, 4 * sizeof(int));
}
cout << i;
for (i = 49999; i >= 0; --i)
{
HeapFree(heap, 0, pointers[i]);
}
cout << "!";
delete [] pointers;
HeapDestroy(heap);
}