1. Big Memory leak with division operator ?
- Posted by Domingo Alvarez Duarte <domingo at dad-it.com>
Jun 19, 2007
-
Last edited Jun 20, 2007
I've just started with euphoria and testing EUSQLite with it's script that
insert 100000 rows in the bench database, I discovered that euphoria leaks a
lot of memory when computing "(100.0*rand(RAND_MAX)/(RAND_MAX+1.0))" inside
the insertion loop, actually it ends with more than 20MB of shared memory,
when changing that code with "(100.0*6)" the leak almost disappear.
The script is sqlite_insert.exw, I'm testing it with XUbuntu 7.04 !
I'll appreciate if someone can solve that, thanks !
2. Re: Big Memory leak with division operator ?
Domingo Alvarez Duarte wrote:
> I've just started with euphoria and testing EUSQLite with it's script that
> insert 100000 rows in the bench database, I discovered that euphoria leaks a
> lot of memory when computing "(100.0*rand(RAND_MAX)/(RAND_MAX+1.0))" inside
>
> the insertion loop, actually it ends with more than 20MB of shared memory,
> when changing that code with "(100.0*6)" the leak almost disappear.
>
> The script is sqlite_insert.exw, I'm testing it with XUbuntu 7.04 !
>
> I'll appreciate if someone can solve that, thanks !
Perhaps you could test the division and rand operations in a loop
by themselves. I haven't had time. It's possible that there
is no actual leak, just some very inefficient use of memory.
I remember once having a loop where a large and growing block of memory
was repeatedly allocated, followed by a small amount of space for a
floating-point number. This created a pattern in memory
where storage could not be recombined into a big enough block,
due to all the floating-point numbers. e.g.
[big block][f.p][big block][f.p][big block][f.p.]... etc.
I kept needing a block a few bytes larger than any already
allocated, and the freed big blocks could not be merged together
due to the f.p. numbers which hadn't been freed. Perhaps you
have a similarly perverse situation.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com