Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1513: fix "mallinfo is deprecated" warning #1798

Merged
merged 3 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-11-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variables:
VT_DOCS: 0
VT_ASAN: 0
VT_UBSAN: 0
VT_WERROR: 0
VT_WERROR: 1
VT_POOL: 1
VT_EXTENDED_TESTS: 1
VT_TESTS_NUM_NODES: 2
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-12-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variables:
VT_DOCS: 0
VT_ASAN: 0
VT_UBSAN: 0
VT_WERROR: 0
VT_WERROR: 1
VT_POOL: 1
VT_EXTENDED_TESTS: 1
VT_TESTS_NUM_NODES: 2
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-13-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variables:
VT_DOCS: 0
VT_ASAN: 0
VT_UBSAN: 0
VT_WERROR: 0
VT_WERROR: 1
VT_POOL: 1
VT_EXTENDED_TESTS: 1
VT_TESTS_NUM_NODES: 2
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-14-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variables:
VT_DOCS: 0
VT_ASAN: 0
VT_UBSAN: 0
VT_WERROR: 0
VT_WERROR: 1
VT_POOL: 1
VT_EXTENDED_TESTS: 1
VT_TESTS_NUM_NODES: 2
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-11-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variables:
VT_DOCS: 0
VT_ASAN: 0
VT_UBSAN: 0
VT_WERROR: 0
VT_WERROR: 1
VT_POOL: 1
VT_EXTENDED_TESTS: 1
VT_TESTS_NUM_NODES: 2
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-12-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variables:
VT_DOCS: 0
VT_ASAN: 0
VT_UBSAN: 0
VT_WERROR: 0
VT_WERROR: 1
VT_POOL: 1
VT_EXTENDED_TESTS: 1
VT_TESTS_NUM_NODES: 2
Expand Down
1 change: 1 addition & 0 deletions cmake/check_system_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ check_function_exists(sysconf vt_has_sysconf)

set(CMAKE_REQUIRED_INCLUDES "malloc.h")
check_function_exists(mallinfo vt_has_mallinfo)
check_function_exists(mallinfo2 vt_has_mallinfo2)
cz4rs marked this conversation as resolved.
Show resolved Hide resolved

set(CMAKE_REQUIRED_INCLUDES "sys/resource.h")
check_function_exists(getrusage vt_has_getrusage)
Expand Down
1 change: 1 addition & 0 deletions cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#cmakedefine vt_has_pclose
#cmakedefine vt_has_sbrk
#cmakedefine vt_has_mallinfo
#cmakedefine vt_has_mallinfo2
#cmakedefine vt_has_getrusage
#cmakedefine vt_has_sysinfo
#cmakedefine vt_has_mach_task_self
Expand Down
6 changes: 0 additions & 6 deletions scripts/workflows-azure.ini
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,13 @@ compiler_type = gnu
compiler = gcc-11
distro = 22.04
output_name = ci/azure/azure-gcc-11-ubuntu-mpich.yml
vt_werror = 0

[PR-tests-gcc-12]
test_configuration = "gcc-12, ubuntu, mpich"
compiler_type = gnu
compiler = gcc-12
distro = 22.04
output_name = ci/azure/azure-gcc-12-ubuntu-mpich.yml
vt_werror = 0

[PR-tests-clang-39]
test_configuration = "clang-3.9, ubuntu, mpich"
Expand Down Expand Up @@ -241,28 +239,24 @@ compiler_type = clang
compiler = clang-11
distro = 22.04
output_name = ci/azure/azure-clang-11-ubuntu-mpich.yml
vt_werror = 0

[PR-tests-clang-12]
test_configuration = "clang-12, ubuntu, mpich"
compiler_type = clang
compiler = clang-12
distro = 22.04
output_name = ci/azure/azure-clang-12-ubuntu-mpich.yml
vt_werror = 0

[PR-tests-clang-13]
test_configuration = "clang-13, ubuntu, mpich"
compiler_type = clang
compiler = clang-13
distro = 22.04
output_name = ci/azure/azure-clang-13-ubuntu-mpich.yml
vt_werror = 0

[PR-tests-clang-14]
test_configuration = "clang-14, ubuntu, mpich"
compiler_type = clang
compiler = clang-14
distro = 22.04
output_name = ci/azure/azure-clang-14-ubuntu-mpich.yml
vt_werror = 0
18 changes: 11 additions & 7 deletions src/vt/utils/memory/memory_usage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,17 @@ std::string PS::getName() {
}

std::size_t Mallinfo::getUsage() {
# if defined(vt_has_mallinfo) && defined(vt_has_malloc_h) && !vt_check_enabled(mimalloc)
struct mallinfo mi = mallinfo();
unsigned int blocks = mi.uordblks;
return static_cast<std::size_t>(blocks);
# else
return 0;
# endif
#if vt_check_enabled(mimalloc) || \
(!defined(vt_has_mallinfo) && !defined(vt_has_mallinfo2))
return 0;
#else
#if defined(vt_has_mallinfo2)
auto mi = mallinfo2();
#elif defined(vt_has_mallinfo)
auto mi = mallinfo();
#endif
return static_cast<std::size_t>(mi.uordblks);
#endif
}

std::string Mallinfo::getName() {
Expand Down