Lines Matching refs:Allocator
47 void checkMemoryTaggingMaybe(AllocatorT *Allocator, void *P, scudo::uptr Size, in checkMemoryTaggingMaybe() argument
51 if (Allocator->useMemoryTaggingTestOnly()) in checkMemoryTaggingMaybe()
59 ? Allocator->useMemoryTaggingTestOnly() in checkMemoryTaggingMaybe()
70 template <typename Config> struct TestAllocator : scudo::Allocator<Config> {
91 Allocator = std::make_unique<AllocatorT>(); in ScudoCombinedTest()
94 Allocator->releaseToOS(); in ~ScudoCombinedTest()
103 std::unique_ptr<AllocatorT> Allocator; member
132 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
135 Allocator->isOwned(&StaticBuffer[scudo::Chunk::getHeaderSize()])); in SCUDO_TYPED_TEST()
140 EXPECT_FALSE(Allocator->isOwned(&StackBuffer[scudo::Chunk::getHeaderSize()])); in SCUDO_TYPED_TEST()
147 auto *Allocator = this->Allocator.get(); in BasicTest() local
158 void *P = Allocator->allocate(Size, Origin, Align); in BasicTest()
160 EXPECT_TRUE(Allocator->isOwned(P)); in BasicTest()
162 EXPECT_LE(Size, Allocator->getUsableSize(P)); in BasicTest()
164 checkMemoryTaggingMaybe(Allocator, P, Size, Align); in BasicTest()
165 Allocator->deallocate(P, Origin, Size); in BasicTest()
198 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
204 void *P = Allocator->allocate(Size, Origin, 1U << MinAlignLog, true); in SCUDO_TYPED_TEST()
209 Allocator->deallocate(P, Origin, Size); in SCUDO_TYPED_TEST()
215 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
218 Allocator->setFillContents(scudo::ZeroFill); in SCUDO_TYPED_TEST()
222 void *P = Allocator->allocate(Size, Origin, 1U << MinAlignLog, false); in SCUDO_TYPED_TEST()
227 Allocator->deallocate(P, Origin, Size); in SCUDO_TYPED_TEST()
233 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
238 Allocator->setFillContents(scudo::PatternOrZeroFill); in SCUDO_TYPED_TEST()
242 void *P = Allocator->allocate(Size, Origin, 1U << MinAlignLog, false); in SCUDO_TYPED_TEST()
248 !Allocator->useMemoryTaggingTestOnly()) in SCUDO_TYPED_TEST()
254 Allocator->deallocate(P, Origin, Size); in SCUDO_TYPED_TEST()
260 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
264 void *NeedleP = Allocator->allocate(NeedleSize, Origin); in SCUDO_TYPED_TEST()
265 Allocator->deallocate(NeedleP, Origin); in SCUDO_TYPED_TEST()
268 void *P = Allocator->allocate(NeedleSize, Origin); in SCUDO_TYPED_TEST()
269 if (Allocator->getHeaderTaggedPointer(P) == in SCUDO_TYPED_TEST()
270 Allocator->getHeaderTaggedPointer(NeedleP)) in SCUDO_TYPED_TEST()
272 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
278 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
283 void *P = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
287 void *NewP = Allocator->reallocate(P, Size * 2); in SCUDO_TYPED_TEST()
295 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
299 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
305 void *P = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
310 void *NewP = Allocator->reallocate(P, Size); in SCUDO_TYPED_TEST()
316 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
320 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
328 void *P = Allocator->allocate(ReallocSize, Origin); in SCUDO_TYPED_TEST()
333 void *NewP = Allocator->reallocate(P, NewSize); in SCUDO_TYPED_TEST()
337 checkMemoryTaggingMaybe(Allocator, NewP, NewSize, 0); in SCUDO_TYPED_TEST()
339 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
343 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
353 V.push_back(Allocator->allocate( in SCUDO_TYPED_TEST()
355 Allocator->disable(); in SCUDO_TYPED_TEST()
356 Allocator->iterateOverChunks( in SCUDO_TYPED_TEST()
364 Allocator->enable(); in SCUDO_TYPED_TEST()
366 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
371 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
376 if (!Allocator->useMemoryTaggingTestOnly()) in SCUDO_TYPED_TEST()
381 void *P = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
382 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
389 void *P = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
390 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
398 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
400 if (Allocator->useMemoryTaggingTestOnly()) { in SCUDO_TYPED_TEST()
402 void *P = Allocator->allocate(2048, Origin); in SCUDO_TYPED_TEST()
405 Allocator->disableMemoryTagging(); in SCUDO_TYPED_TEST()
407 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
409 P = Allocator->allocate(2048, Origin); in SCUDO_TYPED_TEST()
412 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
414 Allocator->releaseToOS(); in SCUDO_TYPED_TEST()
419 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
423 scudo::uptr ActualSize = Allocator->getStats(Buffer.data(), BufferSize); in SCUDO_TYPED_TEST()
427 ActualSize = Allocator->getStats(Buffer.data(), BufferSize); in SCUDO_TYPED_TEST()
438 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
442 V.push_back(Allocator->allocate( in SCUDO_TYPED_TEST()
445 Allocator->deallocate(P, Origin); in SCUDO_TYPED_TEST()
448 auto *TSD = Allocator->getTSDRegistry()->getTSDAndLock(&UnlockRequired); in SCUDO_TYPED_TEST()
460 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
472 void *P = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
479 Allocator->deallocate(Pair.first, Origin, Pair.second); in SCUDO_TYPED_TEST()
490 Allocator->releaseToOS(); in SCUDO_TYPED_TEST()
535 auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT()); in TEST() local
538 void *P = Allocator->allocate(Size, Origin); in TEST()
542 EXPECT_DEATH(Allocator->deallocate(P, Origin, Size + 8U), ""); in TEST()
547 EXPECT_DEATH(Allocator->deallocate(MisalignedP, Origin, Size), ""); in TEST()
548 EXPECT_DEATH(Allocator->reallocate(MisalignedP, Size * 2U), ""); in TEST()
554 EXPECT_DEATH(Allocator->deallocate(P, Origin, Size), ""); in TEST()
556 EXPECT_DEATH(Allocator->deallocate(P, Origin, Size), ""); in TEST()
560 Allocator->deallocate(P, Origin, Size); in TEST()
561 EXPECT_DEATH(Allocator->deallocate(P, Origin, Size), ""); in TEST()
562 EXPECT_DEATH(Allocator->reallocate(P, Size * 2U), ""); in TEST()
563 EXPECT_DEATH(Allocator->getUsableSize(P), ""); in TEST()
570 auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT()); in TEST() local
584 P = Allocator->allocate(Size - 64U, Origin); in TEST()
591 Allocator->deallocate(V.back(), Origin); in TEST()
601 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
602 Allocator->releaseToOS(); in SCUDO_TYPED_TEST()
606 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
608 if (!Allocator->useMemoryTaggingTestOnly()) in SCUDO_TYPED_TEST()
626 Allocator->allocate(Size - scudo::Chunk::getHeaderSize(), Origin))); in SCUDO_TYPED_TEST()
644 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
648 Allocator->setOption(scudo::Option::ThreadDisableMemInit, 1); in SCUDO_TYPED_TEST()
662 Ptrs[I] = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
666 Allocator->deallocate(Ptrs[I], Origin, Size); in SCUDO_TYPED_TEST()
668 Ptrs[I] = Allocator->allocate(Size - 8, Origin); in SCUDO_TYPED_TEST()
672 Allocator->deallocate(Ptrs[I], Origin, Size - 8); in SCUDO_TYPED_TEST()
674 Ptrs[I] = Allocator->allocate(Size, Origin, 1U << MinAlignLog, true); in SCUDO_TYPED_TEST()
680 Allocator->setOption(scudo::Option::ThreadDisableMemInit, 0); in SCUDO_TYPED_TEST()
684 auto *Allocator = this->Allocator.get(); in SCUDO_TYPED_TEST() local
693 void *P = Allocator->allocate(Size, Origin); in SCUDO_TYPED_TEST()
694 P = Allocator->reallocate(P, Size + 1); in SCUDO_TYPED_TEST()
699 Allocator->deallocate(Ptrs[i], Origin); in SCUDO_TYPED_TEST()