Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testgc2: Make sure GC allocations are not optimized out. #1191

Merged
merged 2 commits into from Nov 19, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 7 additions & 11 deletions test/runnable/testgc2.d
Expand Up @@ -9,16 +9,12 @@ import core.exception : OutOfMemoryError;

void test1()
{
version (none)
{
}
else
{
printf("This should not take a while\n");
try
{
long[] l = new long[ptrdiff_t.max];
assert(0);
long[] l = new long[ptrdiff_t.max];
printf("%lu\n", cast(ulong)l.capacity); // Make sure l is not optimized out.
assert(0);
}
catch (OutOfMemoryError o)
{
Expand All @@ -27,14 +23,14 @@ void test1()
printf("This may take a while\n");
try
{
byte[] b = new byte[size_t.max / 3];
version (Windows)
assert(0);
byte[] b = new byte[size_t.max / 3];
printf("%lu\n", cast(ulong)b.capacity); // Make sure b is not optimized out.
version (Windows)
assert(0);
}
catch (OutOfMemoryError o)
{
}
}
}

/*******************************************/
Expand Down