Skip to content

Commit

Permalink
Remove unused counters of allocated virtual memory.
Browse files Browse the repository at this point in the history
- Use AllocMemory() when creating buffers for CTFileStream::fstrm_pubZipBuffer.
  • Loading branch information
DreamyCecil committed Feb 11, 2025
1 parent cd5804c commit a7628f4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Sources/Engine/Base/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ static SE1_THREADLOCAL BOOL _bThreadCanHandleStreams = FALSE;
// list of currently opened streams
static SE1_THREADLOCAL CListHead *_plhOpenedStreams = NULL;

ULONG _ulVirtuallyAllocatedSpace = 0;
ULONG _ulVirtuallyAllocatedSpaceTotal = 0;

// global string with current MOD path
CTFileName _fnmMod;
// global string with current name (the parameter that is passed on cmdline)
Expand Down Expand Up @@ -949,7 +946,7 @@ void CTFileStream::Open_t(const CTFileName &fnFileName, CTStream::OpenMode om/*=
fstrm_pZipHandle = IZip::Open_t(fnmFullFileName);
fstrm_slZipSize = IZip::GetEntry(fstrm_pZipHandle)->GetUncompressedSize();
// load the file from the zip in the buffer
fstrm_pubZipBuffer = new UBYTE[fstrm_slZipSize];
fstrm_pubZipBuffer = (UBYTE *)AllocMemory(fstrm_slZipSize);
IZip::ReadBlock_t(fstrm_pZipHandle, (UBYTE *)fstrm_pubZipBuffer, 0, fstrm_slZipSize);
// if it is a physical file
} else if (iFile==EFP_FILE) {
Expand Down Expand Up @@ -1051,11 +1048,7 @@ void CTFileStream::Close(void)
// close zip entry
IZip::Close(fstrm_pZipHandle);
fstrm_pZipHandle = NULL;

delete[] fstrm_pubZipBuffer;

_ulVirtuallyAllocatedSpace -= fstrm_slZipSize;
//CPrintF("Freed virtual memory with size ^c00ff00%d KB^C (now %d KB)\n", (fstrm_slZipSize / 1000), (_ulVirtuallyAllocatedSpace / 1000));
FreeMemory(fstrm_pubZipBuffer);
}

// clear dictionary vars
Expand Down

0 comments on commit a7628f4

Please sign in to comment.