Big memory leak in division operator example !
- Posted by Domingo Alvarez Duarte <domingo at dad-it.com> Jun 20, 2007
- 759 views
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 ()