I have a large binary file that is read and compressed with bzip2. I am trying to decrease the compression time, as it's taking around 1min 30sec to complete.
One thing I wanted to try was to expand the size of the buffer for fopen. However, I am noticing that the memory allocated during the compression process is hardly exceeding 7,000K.
Here is my code:
int bzipError = BZ_OK;
BZFILE *bzipLogFile = BZ2_bzWriteOpen(&bzipError, CompressedLogFile, 9, 0, 30);
const int BUF_SIZE = 200000;
char* Buffer = new char[BUF_SIZE];
while (!feof(LogFile)) {
const size_t BytesRead = fread(Buffer, (size_t)1, BUF_SIZE, LogFile);
BZ2_bzWrite(&bzipError, bzipLogFile, Buffer, (int)BytesRead);
}
I realize there is a limit by default that an application can allocate on the heap and stack but I used
#pragma comment(linker, "/STACK:200000")
#pragma comment(linker, "/HEAP:200000")
to try and circumvent this. Clearly I am wrong.