🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.objectpascal
2 messages
2 total messages Started by SH Thu, 10 Nov 2005 20:46
Huge strings and Out of Memory
#48
Author: SH
Date: Thu, 10 Nov 2005 20:46
34 lines
2010 bytes
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
Re: Huge strings and Out of Memory
#50
Author: Riki Wiki
Date: Fri, 11 Nov 2005 21:16
15 lines
1348 bytes
On Thu, 10 Nov 2005 21:46:57 +0100, SH wrote:

> 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>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads