Hello Human,

> Anyway, I'm still looking for a much simpler solution,
> for example a function that can build long
> strings without fragmenting the memory.
> My string will not go above 10MB which I think is not so big.

It is not difficult. Allocate a buffer that is large enough to hold the
maximum size you presume. You write to it using Move procedure and
increment an offset variable that points to the end of the write.

If you need more room that needed in the buffer, just set a flag en
allocate a second buffer.

When the job is dont, then dont free the buffers. Just re-use the
allocated memory for the second (and next) go's.

This way you only allocate memory 1 time and you will not have memory
fragmentation.

Another option is to write direcly to disk instead of building it first
in memory. But probably you have your own reasons for it.

---
Rgds, Wilfried
http://www.mestdagh.biz

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to