memory_operation wrapped_realloc(void* ptr, size_t size)
	{
		START_TEST(type_id, FunctionCalls::REALLOC)
		data.ptr = memkind_realloc(kind, ptr, size);
		data.error_code = errno;
		END_TEST
	}
예제 #2
0
TEST_F(MemkindPmemTests, test_TC_MEMKIND_PmemRealloc)
{
    const size_t size1 = 512;
    const size_t size2 = 1024;
    char *default_str = NULL;

    default_str = (char *)memkind_realloc(pmem_kind, default_str, size1);
    EXPECT_TRUE(NULL != default_str);

    sprintf(default_str, "memkind_realloc MEMKIND_PMEM with size %zu\n", size1);
    printf("%s", default_str);

    default_str = (char *)memkind_realloc(pmem_kind, default_str, size2);
    EXPECT_TRUE(NULL != default_str);

    sprintf(default_str, "memkind_realloc MEMKIND_PMEM with size %zu\n", size2);
    printf("%s", default_str);

    memkind_free(pmem_kind, default_str);
}
TEST_F(MemkindDefaultTests, test_TC_MEMKIND_DefaultRealloc)
{
    const size_t size1 = 512;
    const size_t size2 = 1024;
    char *default_str = NULL;

    default_str = (char *)memkind_realloc(MEMKIND_DEFAULT, default_str, size1);
    EXPECT_TRUE(NULL != default_str);

    sprintf(default_str, "memkind_realloc MEMKIND_DEFAULT with size %zu\n", size1);
    printf("%s", default_str);

    default_str = (char *)memkind_realloc(MEMKIND_DEFAULT, default_str, size2);
    EXPECT_TRUE(NULL != default_str);

    sprintf(default_str, "memkind_realloc MEMKIND_DEFAULT with size %zu\n", size2);
    printf("%s", default_str);

    memkind_free(MEMKIND_DEFAULT, default_str);
}
예제 #4
0
////////////////////////////////////////////////////////////////////////////
// My realloc implementation calling memkind_realloc
////////////////////////////////////////////////////////////////////////////
void *myMemkindRealloc(void *ptr, size_t size)
{

    DBG(2) printf("In my memkind realloc sz:%ld, p1:%p ..", size, ptr);

    void *pp;

    // if we have not initialized memkind HBW arena yet, call default kind
    //
    if (!MemkindInitDone  || !isAllocInHBW(size))
        pp = memkind_realloc(MEMKIND_DEFAULT, ptr, size);
    else {
        DBG(2) printf("\tHBW");
        pp = memkind_realloc(HBW_Type, ptr, size);
        logHBW(pp, size);
    }

    DBG(2) printf("\tptr=%p\n", pp);

    return pp;
}
예제 #5
0
void *hbw_realloc(void *ptr, size_t size)
{
    int i;
    memkind_t kind;
    memkind_t gbtlb_kinds[3] = {MEMKIND_HBW_GBTLB, MEMKIND_HBW_PREFERRED_GBTLB, MEMKIND_GBTLB};

    for (i = 0; i < 3; i++) {
        kind = gbtlb_kinds[i];
        if (kind->ops->check_addr(kind, ptr) == 0) {
            i = -1;
            break;
        }
    }
    if (i != -1) {
        kind = hbw_get_kind(HBW_PAGESIZE_4KB);
    }
    return memkind_realloc(kind, ptr, size);
}
예제 #6
0
파일: hbwmalloc.c 프로젝트: krzycz/memkind
MEMKIND_EXPORT void *hbw_realloc(void *ptr, size_t size)
{
    return memkind_realloc(hbw_get_kind(HBW_PAGESIZE_4KB), ptr, size);
}
예제 #7
0
void* mca_mpool_memkind_realloc(mca_mpool_base_module_t *mpool, void *addr,
                                size_t size)
{
    mca_mpool_memkind_module_t *memkind_module = (mca_mpool_memkind_module_t *) mpool;
    return memkind_realloc (memkind_module->kind, addr, size);
}