-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
109f4b2
commit 6ea5b2f
Showing
11 changed files
with
111 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
*/ | ||
|
||
#ifndef UMF_PROXY_LIB_HANDLERS_H | ||
#define UMF_PROXY_LIB_HANDLERS_H 1 | ||
|
||
#include <umf/memory_pool.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// malloc API handlers | ||
typedef void (*umf_proxy_lib_handler_free_pre_t)( | ||
void *ptr, umf_memory_pool_handle_t pool); | ||
|
||
void umfSetProxyLibHandlerFreePre(umf_proxy_lib_handler_free_pre_t handler); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* UMF_PROXY_LIB_HANDLERS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
*/ | ||
|
||
#if defined(__APPLE__) | ||
#include <malloc/malloc.h> | ||
#else | ||
#include <malloc.h> | ||
#endif | ||
|
||
#include <umf/proxy_lib_handlers.h> | ||
|
||
#include "base.hpp" | ||
#include "test_helpers.h" | ||
#include "utils_common.h" | ||
|
||
using umf_test::test; | ||
|
||
#define SIZE_64 64 | ||
#define ALIGN_1024 1024 | ||
|
||
static int free_cnt = 0; | ||
void handler_free_pre(void *ptr, umf_memory_pool_handle_t pool) { | ||
(void)ptr; | ||
(void)pool; | ||
free_cnt += 1; | ||
} | ||
|
||
TEST_F(test, proxyLib_handlers_free) { | ||
|
||
void *ptr = ::malloc(SIZE_64); | ||
ASSERT_NE(ptr, nullptr); | ||
|
||
umfSetProxyLibHandlerFreePre(handler_free_pre); | ||
ASSERT_EQ(free_cnt, 0); | ||
|
||
::free(ptr); | ||
ASSERT_EQ(free_cnt, 1); | ||
} |
File renamed without changes.