F
fanronghua
Unregistered / Unconfirmed
GUEST, unregistred user!
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
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