Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
From: levi@localhost.nc3a.nato.int
Subject: Memory leak
Date: 25 Sep 2001, 14:27:55
On Tue, 25 Sep 2001, Frank Heckenbach wrote:
> There is a known problem. Some operations (esp. string
> concatenation) need temporary storage (on the stack) which isn't
> freed immediately, so it will accumulate in loops. A trivial example
> follows.
>
> program Foo;
>
> var
> s: String (100) = '';
>
> begin
> repeat
> s := s + ''
> until False
> end.
>
> I think we know the cause of the problem (alloca_string if anyone
> cares) and therefore can fix it soon.
>
> The only know work-around for know is to move the loop body into a
> subroutine. That's not nice, but if it works, you can at least be
> quite sure it's this problem you see.
That was part of my problem. If I modify my code in this style:
program Foo;
var
s: String (100) = '';
procedure loop;
begin
s := s + ''
end;
begin
repeat
loop;
until False
end.
it is not growing that fast any more. (In fact, for this particular example
it is not growing at all.) For that I had to move all the string
operations behind a procedure (i.e. concat, writestr and readstr).
However it is still growing a bit. Could that caused by the calls of the
"random" function in the program?
Cheers,
miklos
Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
| Author | Subject | Date |
|---|---|---|
| Frank Heckenbach | Memory leak | 25 Sep 2001, 10:50:42 |
Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.
Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.
This page was created by Crystal 0.999 (Linux 2.4.27/i686).