diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-01 20:36:32 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-01 20:36:32 +0000 |
commit | 16558f4d3b532fe3da7f6910ad2de7af0322718a (patch) | |
tree | 7cb3306c354edf3a3f8991c2c892cac218b81ecd /llvm/unittests/Support/AllocatorTest.cpp | |
parent | 6b35c86fbe21c209aa436a78cac6b88428ddcb4c (diff) | |
download | bcm5719-llvm-16558f4d3b532fe3da7f6910ad2de7af0322718a.tar.gz bcm5719-llvm-16558f4d3b532fe3da7f6910ad2de7af0322718a.zip |
If BumpPtrAllocator is requested to allocate a size that exceeds the slab size,
increase the slab size.
llvm-svn: 151834
Diffstat (limited to 'llvm/unittests/Support/AllocatorTest.cpp')
-rw-r--r-- | llvm/unittests/Support/AllocatorTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/Support/AllocatorTest.cpp b/llvm/unittests/Support/AllocatorTest.cpp index 6c0fca90456..bc5bd3dc407 100644 --- a/llvm/unittests/Support/AllocatorTest.cpp +++ b/llvm/unittests/Support/AllocatorTest.cpp @@ -93,6 +93,14 @@ TEST(AllocatorTest, TestOverflow) { EXPECT_EQ(2U, Alloc.GetNumSlabs()); } +// Test allocating with a size larger than the initial slab size. +TEST(AllocatorTest, TestSmallSlabSize) { + BumpPtrAllocator Alloc(128); + + Alloc.Allocate(200, 0); + EXPECT_EQ(1U, Alloc.GetNumSlabs()); +} + // Mock slab allocator that returns slabs aligned on 4096 bytes. There is no // easy portable way to do this, so this is kind of a hack. class MockSlabAllocator : public SlabAllocator { |