BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Huge strings and Out of Memory

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal
View previous topic :: View next topic  
Author Message
SH
Guest





PostPosted: Thu Nov 10, 2005 8:46 pm    Post subject: Huge strings and Out of Memory Reply with quote



Hi

I have a simple application containing this code:
---
var s : string;
begin
setlength(s, 1024*1024*512);
showmessage('ok');
setlength(s, 1024*1024*1024);
showmessage('ok');
...
---

The problem is that Delphi spits our an 'Out of Memory' error even though
there's more than 1.2GB free memory available

On the other hand, this code works fine:
---
var s : string;
begin
setlength(s, 1024*1024*1024);
showmessage('ok');
...
---

So it seems like Delphi creates a whole new memory allocation containing
'1024*1024*1024' bytes before unassigning any of the previosuly assigned
'1024*1024*512' bytes.

Is there a work-around for this, so I can make the first code example above
work?

Thanks in advance
Simon


Back to top
Riki Wiki
Guest





PostPosted: Fri Nov 11, 2005 9:16 pm    Post subject: Re: Huge strings and Out of Memory Reply with quote



On Thu, 10 Nov 2005 21:46:57 +0100, SH wrote:

Quote:
Is there a work-around for this, so I can make the first code example above
work?

Hoi Simon

You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question. Further, this newsgroup
do not officially exist, use newsgroup b.p.d.language.delphi.general.

Take a look here:
<http://tinyurl.com/8m5nw>
which links to
<http://delphi.wikicities.com/wiki/Delphi_Newsgroups>

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.