本文整理汇总了C++中Page::allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ Page::allocate方法的具体用法?C++ Page::allocate怎么用?C++ Page::allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::allocate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Page
void* dpBlockAllocator<PageSize, BlockSize>::allocate()
{
for(size_t i=0; i<m_pages.size(); ++i) {
if(void *ret=m_pages[i]->allocate()) {
return ret;
}
}
Page *p = new Page();
m_pages.push_back(p);
return p->allocate();
}
示例2: allocate
void* dpTrampolineAllocator::allocate(void *location)
{
void *ret = nullptr;
if(Page *page=findCandidatePage(location)) {
ret = page->allocate();
}
if(!ret) {
Page *page = createPage(location);
ret = page->allocate();
}
return ret;
}
示例3: multipleAllocFreeTest
void multipleAllocFreeTest() {
int i;
Page *page;
uint32_t ps = ((LocalEnvironment *)m_env)->get_page_size();
for (i = 0; i < 10; i++) {
page = new Page(((LocalEnvironment *)m_env)->get_device());
page->allocate(0, ps);
/* i+2 since we need 1 page for the header page and one page
* for the root page */
if (!m_inmemory)
REQUIRE(page->get_address() == (i + 2) * ps);
delete page;
}
}
示例4: allocFreeTest
void allocFreeTest() {
Page *page;
page = new Page(((LocalEnvironment *)m_env)->get_device());
page->allocate(0, 1024);
delete page;
}