Also try using a better techique for building the string, something like building it into an TStringStream or onto a TStringList. That might make it a bit more faster and safer.
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:delphi-talk- > [EMAIL PROTECTED] On Behalf Of Human > Sent: Friday, March 03, 2006 4:18 PM > To: Delphi-Talk Discussion List > Subject: Re: Strings in Delphi should be 2GB, right? > > Jesus! > That FastMM is FAST! > Building the rapport took 3x less time. > And I don't get that EOutOfMemory error. > TAHNKS ALOT. You have been very helpful !!! > > > > But as always, when I ran into a problem I am never satisfied just to > change the path. > I still want to know how to build big strings using Delphi native > functions. > If someone can give me a hint about that it will satisfy my curiosity. > > > --- Fastream Technologies <[EMAIL PROTECTED]> wrote: > > > Hello Human, > > > > You've run into memory fragmentation. I would sugest you to use NexusMM > > ($120) or FastMM (free). Sorry, I cannot remember the URLs. Google is > your > > friend. > > > > Regards, > > > > SZ > > > > ----- Original Message ----- > > From: "Human" <[EMAIL PROTECTED]> > > To: "Delphi-Talk Discussion List" <[email protected]> > > Sent: Friday, March 03, 2006 1:50 PM > > Subject: Strings in Delphi should be 2GB, right? > > > > > > > Strings in Delphi should be able to store 2GB, right? > > > I got an exception after 4MB. > > > > > > > > > > > > I have to create a report about 800-1000 files in a folder. > > > I've tried to write the report in a TRichEdit component but it was TO > SLOW > > > because the refresh > > > after each line I added. BeginUpdate didn't help at all. Actually it > has > > > no effect. > > > > > > So I decided to write it directly on the HDD as a HTML file. > > > I made a new form and a global variable (called Raport) where I store > the > > > HTML: > > > > > > var Raport: string; > > > procedure TFrmHTML.AddLine(s: String); > > > begin > > > Raport:= Raport+ CRLF+ '<br>'+ s; > > > end; > > > > > > At the end of the program I discharge the content of that variable in > a > > > file. > > > The problem is that after exactly 4MB it gives me an EOutOfMemory > error. > > > It appears when I try to add more characters to that Raport variable. > > > The CPU window shows me that the exception was 'born' in the > @StrSetLength > > > function which is not > > > documented in my Help file (Delphi 7). > > > After this the program quit the main loop (leaving few file not > > > processed). > > > > > > What it is strange it the fact that after the exception is raised and > > > closed, I continue to write > > > to that variable (the end of the HTML </body> </html>) and it accept > > > without rising the exception. > > > Finally the string is saved gracefully on the HDD. > > > > > > I have 768 BM of RAM in my computer. All the time AT LEAST 250MB are > free > > > (I use CacheMan XP to > > > monitor my memory). > > > One hour ago the program worked ok, till the end (it processed all 822 > > > files). > > > > > > The memory requirements were: > > > After it finished: 37MB > > > Peak memory : 39MB > > > Virtual mem : 32MB > > > In my system the page file usage was 565MB (I had other huge > applications > > > running). > > > > > > > > > Why it runs out of memory? It isn't supposed to use VM when it runs > out of > > > real memory (which it > > > isn't my case anyway). > > > What will happen if I want to process more that 1000 files? > > > > > > > > > PS: I don't want to use a third party Report component. I've took a > look > > > at few free and trial > > > components. > > > They where to expensive, or to slow, or much to complex (and in the > same > > > time big in size). > > > I just want to write line of text with monospaced characters/font and > some > > > letters should be > > > colored in red. That's all. > > > > > > > > > ...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 > > > > __________________________________________________ > > 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 __________________________________________________ Delphi-Talk mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi-talk
