Out of memory in MakeDocumentFromStream

General TRichView support forum. Please post your questions here
Post Reply
a.mancini
Posts: 20
Joined: Tue Jan 16, 2024 3:35 pm

Out of memory in MakeDocumentFromStream

Post by a.mancini »

Hello,

I would like to report an issue with the MakeDocumentFromStream function.

Steps to Reproduce:
1. Set the linewidth property to 0 (no automatic carriage return).
2. Write a single line with 2548 characters.

Observed Issue:
When reading the stream in MakeDocumentFromStream, the value of the Chunk variable during the second read is identical to the Buffer variable. As a result, the Buffer loses the first 1024 characters that were initially read.

Proposed Fix:
I resolved the issue (at least in my case) by replacing the following line:

Stream.ReadBuffer(PRVAnsiChar(Chunk)^, ChunkSize);

with:
Stream.ReadBuffer(Chunk[1], ChunkSize);

This seems to fix the iusse.

Best regards,
Alessandro Mancini
Post Reply