Pastey memoryleak on Euphoria-09-Feb-2013
- Posted by useless_
Feb 10, 2013
--
-- This leaks ~ 20 megabytes per second.
-- The longer version of the leaktest code had an additional feature:
-- if the exit line was commented out, theleak stopped.
--
-- This seems to be a race condition of some sort,
-- whereby there is an OS call to free memory
-- but Eu doesn't release the cpu to give the OS time to perform the call.
-- Eventually, all available memory and cpu clocks are eaten by this code.
--
-- useless (was Kat) Sunday 2/10/2013
--
without warning
include std/search.e -- match_replace
include std/io.e -- read_file
with trace
object junk = 0
object testtext = "{{Infobox person | image = CharlizeTheronFeb08.jpg\n}}\n</page>\n.\n.\n"
object data
object nestcount1, nestcount2
puts(1,"running....\n")
while 1 do
data = testtext
--
-- leak is somewhere between here........
--
for nestloop = 1 to length(data)-1 do
junk = data[1..nestloop+1]
nestcount1 = match_all("{{",junk)
nestcount2 = match_all("}}",junk)
if equal(length(nestcount1),length(nestcount2)) then
junk = junk
exit
end if
end for
--
-- ... and here
--
end while
--