Re: memory use increasing while running, till...
- Posted by mattlewis (admin) Dec 29, 2012
- 1088 views
What happened to the leak in reverse() at line sequence.e:565 - t[uppr] = target[lowr]?
It's replace() that leaks the memory allocated by that line.
That doesn't sound right, that memory used in one procedure still exists to be used by another, when that second procedure may never be called. IIRC, i ran reverse() alone in the while loop and it wasn't a memory hog by itself, ditto running match_replace() by itself.
The memory I'm referring to is the memory that's used to store a sequence. So, to your euphoria code, it's just a sequence. To the back end, it's a chunk of memory that's been allocated, to be freed up when the sequence's reference count drops to zero.
The implementation of replace() is somewhat complex, based on the data being replaced and the data replacing the old data. Add to that the complications of doing things in place vs making copies, and things get very complex. So basically, you've found a case where we're not handling the reference counts correctly in the bowels of replace().
You can find the implementation in be_runtime.c:Replace().
Matt