Difference between DList and SList from garbage collector point of view
Alexandr Druzhinin
drug2004 at bk.ru
Sun Feb 24 12:16:25 PST 2013
I used in my application DList (code is large and I couldn't reduce it)
and the application allocates memory always. I can not realize why and
don't know it now. But when I replaced DList by SList (and even dynamic
array) memory leaks disappeared at all and all works as expected. I know
it is hard to help me without code but what may be reason of this? May
be I don't know some simple things I should and just misuse DList?
About code causing memory leaks - it is trivial loop:
class DataChunk {
...
}
DList!DataChunk patch;
(RedBlackTree!DataChunk)[uint] _container_map;
...
foreach(datachunk; find!isNewer(_container_map[source][])) {
patch.insertFront(datachunk);
}
if I replace DList by SList all works fine - size of used memory is the
same all the time. But with DList the application uses memory more and more.
More information about the Digitalmars-d-learn
mailing list