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

Try to fix remaining ASAN-reported leaks #7767

Merged
merged 1 commit into from
Aug 21, 2023
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
5 changes: 5 additions & 0 deletions cmake/toolchain.linux-x64-asan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/env)
# Can't mix -fsanitize=address with -fsanitize=fuzzer
set(WITH_TEST_FUZZ OFF)

# Sanitizer builds intermittently fail when using CCache for reasons that aren't
# clear; default to turning it off
set(Halide_CCACHE_BUILD OFF)

if (NOT DEFINED Halide_SHARED_ASAN_RUNTIME_LIBRARY)
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} "-print-file-name=libclang_rt.asan.so"
Expand All @@ -49,3 +53,4 @@ set(
Halide_PYTHON_LAUNCHER
${CMAKE_COMMAND} -E env ASAN_OPTIONS=detect_leaks=0 LD_PRELOAD=${Halide_SHARED_ASAN_RUNTIME_LIBRARY}
)

4 changes: 4 additions & 0 deletions cmake/toolchain.linux-x64-fuzzer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/env)

# Sanitizer builds intermittently fail when using CCache for reasons that aren't
# clear; default to turning it off
set(Halide_CCACHE_BUILD OFF)
2 changes: 2 additions & 0 deletions test/correctness/skip_stages_memoize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ int main(int argc, char **argv) {
return 1;
}

Internal::JITSharedRuntime::release_all();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, in what cases do you need to explicitly call this to prevent leaks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever memoize is used in a jit test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, not the case in my driver code


printf("Success!\n");
return 0;
}
3 changes: 3 additions & 0 deletions test/generator/error_codes_aottest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ int main(int argc, char **argv) {
check(result, correct);
in.dim = shape;

free(in.host);
free(out.host);

printf("Success!\n");
return 0;
}