Am 07.12.2013 19:07, schrieb thedeemon:

A quick glance into the source shows that removing an entry does not allocate, but calls GC.free(). Inserting an entry does allocate. Rehashing happens when entries are added, not when they are removed.

Check your destructors again, make sure they are not called twice.

Thanks for your quick answer. So the call to GC.free() breaks it. Seems easy to fix, just don't free and let the GC do its work. Whatever, I've solved my problems by nulling out the value and calling a cleanup routine before the next entry is added.

        private static void cleanObjects()
        {
            if (shouldCleanObjects) {
                foreach (key, val; objects) {
                    if (!val) {
                    objects.remove( key);
                }
            }
            shouldCleanObjects = false;
          }
        }

Seems to work, but I'm not shure if it is save to remove entrys while iterating. Can't find any advise at this.


Gerrit Wichert

Reply via email to