I realize that this might sound strange, but try setting myAA to null after clear(), this should fix the crash.

David


On 5/31/11 4:00 PM, useo wrote:
Hi,

I'm trying to clear big associative arrays, but I always get an
object error - what I currently doing is:

private string[uint] myAA;

void main() {

    fill(myAA);
    myAA.clear();
    fill(myAA); // object.Error: Access Violation
}

void fill(string[uint] aa) {
    for (uint i = 0; i<  10_000_000_000; i++) {
       myAA[i] = std.conv.to!(string)(i);
    }
}

I already saw the bug report at http://www.digitalmars.com/d/archives/
digitalmars/D/bugs/
Issue_5683_New_Calling_.clear_on_a_fresh_associative_array_causes_subsequent_segfault_28632.html
and I'm also using 2.052 - as I saw at the change-log of 2.053 it's
also unfixed. So... is there any solution to clear associative arrays
without memory leaking?

Reply via email to