Re: Big memory leak in division operator example !
- Posted by Robert Craig <rds at RapidEuphoria.com> Jun 20, 2007
- 672 views
Domingo Alvarez Duarte wrote: > The program bellow can be used to see the memory leak, > after the first loop the memory comsumption remain the same, > but after the second it raises to more than 20MB. > > Linux XUbuntu 7.04 and Euphoria 3.1 > > -------- > > include machine.e > include get.e > > integer N > atom x, y, z > object Void > > constant RAND_MAX = 1073741823 > > N = 100000 > > puts (1, "starting multiply...\n") > Void = wait_key () > > for i = 0 to N -1 do > x = 50.0 * 5 > y = 50.0 * 9 > z = 50.0 * 976 > end for > > puts (1, "No memory leak till now !!!\nstarting division...\n") > Void = wait_key () > > for i = 0 to N -1 do > x = 50.0 - (100.0*rand(RAND_MAX)/(RAND_MAX+1.0)) > y = 50.0 - (100.0*rand(RAND_MAX)/(RAND_MAX+1.0)) > z = 50.0 - (100.0*rand(RAND_MAX)/(RAND_MAX+1.0)) > end for > > puts (1, "Look at the memory leak now !!!!\nfinished...\n") > Void = wait_key () I raised the iterations to N = 10000000, and took out the wait_key() calls, and couldn't see any memory leak using ex, exw, or exwc (with Windows Task Manager). Which Linux command did you use to measure the amount of memory being used, and does the memory usage keep rising with more iterations, or does it stop at 20 Mb? Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com