Buffer overflow when assigning value to JVMemDS dataset fiel |
|
I'm migrating a file translator/mapper program from D7 to XE5, was using
RXMemoryData but due to lots of unicode compatibility issues, plugged in
JVMemoryDataset inplace as direct part replacement.
My program deals with processing text files, translation and mapping.
It is ok when running for smaller files (100k to 400k lines).
However when running for larger files(up to 1mil+ lines), the memory usage
went over the roof and caused application termination due to OOM issue.
I've enabled madExcept's buffer overrun protection and it keep crashing at
the line when a string dataset field being asssigned with value.
The exception thrown as below:
Access Violation at address 50059F27 in module 'rtl190.bpl'. Read of address
04C30000
The address where the exception was thrown from is always fixed at 50059F27
but the memory address being read is different all the time.
With that being said, the file line number being processed at the time the
AV occurs are also varies and without consistent pattern.
Hence, eventhough the exact line in the code where it fails is
consistent(when a string dataset field being asssigned with value), the
iteration it fails are random and difficult to put a breakpoint just before
it happen to inspect the memory.
Any ideas?
Cheers,
Arif
|