> Wilfried Mestdagh > 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.
Until now your solution seems the best, after FastMM. But since FastMM behave a little bit strange, I think I will switch to your solution. Thanks. > Wilfried Mestdagh > Another option is to write directly to disk instead of building it first > in memory. But probably you have your own reasons for it. YES, this should be the simplest solution but the report has lost of lines and I this that writing to disk so often will be really slow. Also, I discovered that I need to keep the whole report in memory until it is fully built, then I have to sort the paragraphs in a special order. So, writing to disk is excluded. Thank you to everybody for any ideas and suggestions. Even if my problem is almost solved now, I would like to receive (and I will search for more) information about writing huge strings with Delphi's native functions. I really believe that those smart guys at Borland left an elegant (if not elegant, at least handy) solution for us. --- Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: > 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 > ...and the traveler died, stroked by the beauty of the landscape. THE MORNING OF THE MAGICIANS Louis Pawels & Jacques Bergier __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __________________________________________________ Delphi-Talk mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi-talk
