Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1159 from schveiguy/issue14126
Browse files Browse the repository at this point in the history
Fixed issue 14126 -- GC seemingly corrupting memory
  • Loading branch information
dnadlinger committed Feb 6, 2015
2 parents 8c13443 + 21aba9e commit 1c5aef8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/rt/lifetime.d
Expand Up @@ -1337,7 +1337,7 @@ void finalize_array2(void* p, size_t size) nothrow
{
si = *cast(TypeInfo_Struct*)(p + size_t.sizeof);
size = *cast(size_t*)p;
p += LARGEPAD;
p += LARGEPREFIX;
}

try
Expand Down Expand Up @@ -2670,3 +2670,19 @@ unittest
import core.exception : InvalidMemoryOperationError;
assert(!test!InvalidMemoryOperationError);
}

// test bug 14126
unittest
{
static struct S
{
S* thisptr;
~this() { assert(&this == thisptr); thisptr = null;}
}

S[] test14126 = new S[2048]; // make sure we allocate at least a PAGE
foreach(ref s; test14126)
{
s.thisptr = &s;
}
}

0 comments on commit 1c5aef8

Please sign in to comment.