Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #include "common_test.h" |
| 4 | |
| 5 | namespace art { |
| 6 | |
| 7 | class HeapTest : public CommonTest {}; |
| 8 | |
Brian Carlstrom | 693267a | 2011-09-06 09:25:34 -0700 | [diff] [blame] | 9 | TEST_F(HeapTest, GarbageCollectClassLinkerInit) { |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 10 | // garbage is created during ClassLinker::Init |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 11 | |
| 12 | Class* c = class_linker_->FindSystemClass("[Ljava/lang/Object;"); |
| 13 | for (size_t i = 0; i < 1024; ++i) { |
Brian Carlstrom | 40381fb | 2011-10-19 14:13:40 -0700 | [diff] [blame^] | 14 | SirtRef<ObjectArray<Object> > array(ObjectArray<Object>::Alloc(c, 2048)); |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 15 | for (size_t j = 0; j < 2048; ++j) { |
| 16 | array->Set(j, String::AllocFromModifiedUtf8("hello, world!")); |
| 17 | } |
| 18 | } |
| 19 | |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 20 | Heap::CollectGarbage(); |
| 21 | } |
| 22 | |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 23 | } // namespace art |