[fpc-pascal] TFileStream.WriteBuffer() and RAM used ?

Michael Van Canneyt michael at freepascal.org
Thu Dec 8 17:36:35 CET 2016



On Thu, 8 Dec 2016, fredvs wrote:

> Hello.
>
> In a audio library, it uses a buffer to record audio.
>
> There is a main loop that store the audio-data given by the audio-input
> device into the buffer.
> For this TFileStream.WriteBuffer() is used.
>
> Ok, all works well.
>
> But I noted that the ram used increase at each loop and when the max ram is
> reached, the program crash.
>
> How must I deal with Data.WriteBuffer(), must I write it to a temp file ?
>
> I was thinking that the memory manager will do the job when
> TFileStream.WriteBuffer() is called.

WriteBuffer will write the data to file. No extra buffer is allocated.
The memory manager does not come into play.

What happens with the buffer in which you had data, this we do not know.

Michael.


More information about the fpc-pascal mailing list