Skip to content

Commit

Permalink
Merge pull request #76 from meekee7/vmem-quickfix
Browse files Browse the repository at this point in the history
VirtualMem: quick and dirty workaround
  • Loading branch information
GamerDude27 committed Apr 19, 2020
2 parents e1a7f75 + 3dcf9b4 commit 5a5c9e2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jp2_pc/Source/Lib/Sys/VirtualMem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ CVirtualMem::CVirtualMem
AutoSetMemory();

// reserve a block of VM of the specified size
pu1AllocateBase = (uint8*)VirtualAlloc(NULL,u4_mem_pool,MEM_RESERVE,PAGE_READWRITE);
//pu1AllocateBase = (uint8*)VirtualAlloc(NULL,u4_mem_pool,MEM_RESERVE,PAGE_READWRITE);

//TODO using new[] is a quickfix until VirtualMem is repaired and VirtualAlloc can be used again
//TODO also see destructor below
pu1AllocateBase = new uint8[u4_mem_pool];
Assert(pu1AllocateBase != NULL);

MEMLOG_ADD_COUNTER(emlVirtualPool,u4_mem_pool);
Expand Down Expand Up @@ -223,7 +227,12 @@ CVirtualMem::~CVirtualMem
// remove any committed memory
if (pvBase)
{
Verify( VirtualFree(pvBase, u4Length, MEM_DECOMMIT) );
//Verify( VirtualFree(pvBase, u4Length, MEM_DECOMMIT) );

//TODO using delete[] is a quickfix until VirtualMem is repaired and VirtualFree can be used again
//TODO also see constructor above
delete[] static_cast<uint8*>(pvBase);
pvBase = nullptr;
}

// there is no commited memory any more, and the virtual pages require no memory
Expand Down

0 comments on commit 5a5c9e2

Please sign in to comment.