Re: memory use increasing while running, till...
- Posted by DerekParnell (admin) Dec 28, 2012
- 1203 views
I am not sure you want to know of the bug. No one has asked for the code to demo the bug. The way i see it, i am a pita if i do or if i don't post it. I don't know what to do. So i am looking for a very narrow set of words in the right order that, to me, will absolve me of blame if i post the code. Cojabo encouraged me to post it, but i see that as Jeremy encouraging me to be on the dev list: it ends with me siting in a corner under a blanket.
I don't understand - blame for what? Finding a bug is not something to be blamed for.
Anyhow, I've got your demo code now and I have narrowed down the scope of where to look.
If you remove the call to reverse(), the problem doesn't happen. But it's not that simple. If one leaves the call to reverse() in, but changes match_replace() like this ...
--haystack = replace(haystack, replacement, posn, posn + needle_len) haystack = haystack[1 .. posn-1] & replacement & haystack[posn + needle_len + 1 .. $]
the problem goes away too.
So, the problem lies with the interaction of the reverse() and replace() calls. Without looking at the IL code yet, it looks like a dereference is being skipped for some reason.
Here is Kat's demo code that she emailed to me (sorry Kat if you wanted this code to be kept a secret but you're email didn't specify that)...
-- quickly eats up all available ram -- include std/sequence.e -- reverse include std/search.e -- match_replace sequence data1, data2, data3 data1 = "<_" while 1 do data2 = reverse(data1) data3 = match_replace('_',data2,' ') -- underscore,data2,space end while