Several memory leaks for utest_run
Submitted by Frank Dittrich
Assigned to Xiuli Pan
Description
This is with latest beignet (commit fc410ee2) and the patch mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=93625.
I built beignet with adddress sanitizer support (-fsanitize=address) and then in the utests/ directory ran
$ . setenv.sh $ ./utest_run
At the end of that test, several memory leaks (direct and indirect) are reported.
Here are some examples of beignet memory leaks:
================================================================= ==12727==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 262144 byte(s) in 1 object(s) allocated from: #0 0x7f68854b196a in malloc (/lib64/libasan.so.2+0x9896a) #1 0x7f688502191c in image_1D_buffer() /home/fd/git/beignet/utests/image_1D_buffer.cpp:7
Direct leak of 119280 byte(s) in 2485 object(s) allocated from: #0 0x7f68854b2872 in operator new(unsigned long) (/lib64/libasan.so.2+0x99872) #1 0x7f687c0aca8a in gbe::PrintfParser::runOnFunction(llvm::Function&) /home/fd/git/beignet/backend/src/llvm/llvm_printf_parser.cpp:543 #2 0x7f687d0c38d1 in llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/fd/git/beignet/build/backend/src/libgbe.so+0x15958d1)
Direct leak of 8192 byte(s) in 1 object(s) allocated from: #0 0x7f68854b196a in malloc (/lib64/libasan.so.2+0x9896a) #1 0x7f6885024314 in compare_image_2d_and_1d_array /home/fd/git/beignet/utests/compare_image_2d_and_1d_array.cpp:20
Direct leak of 8192 byte(s) in 1 object(s) allocated from: #0 0x7f68854b196a in malloc (/lib64/libasan.so.2+0x9896a) #1 0x7f6885024323 in compare_image_2d_and_1d_array /home/fd/git/beignet/utests/compare_image_2d_and_1d_array.cpp:21
Direct leak of 7952 byte(s) in 36 object(s) allocated from: #0 0x7f68854b1b09 in __interceptor_calloc (/lib64/libasan.so.2+0x98b09) #1 0x7f68848fa245 in cl_calloc /home/fd/git/beignet/src/cl_alloc.c:54
Direct leak of 2737 byte(s) in 1 object(s) allocated from: #0 0x7f68854b196a in malloc (/lib64/libasan.so.2+0x9896a) #1 0x7f6884fb8238 in runtime_compile_link() /home/fd/git/beignet/utests/runtime_compile_link.cpp:82 #2 0x7f68850e489f (/home/fd/git/beignet/build/utests/libutests.so+0x54f89f)
Direct leak of 2048 byte(s) in 1 object(s) allocated from:
#0 0x7f68854b1b09 in __interceptor_calloc (/lib64/libasan.so.2+0x98b09)
#1 0x7f68850256b0 in compiler_fill_image_1d_array /home/fd/git/beignet/utests/compiler_fill_image_1d_array.cpp:34
#2 0x7fff5ce299af (<unknown module>
)
Direct leak of 732 byte(s) in 1 object(s) allocated from: #0 0x7f68854b196a in malloc (/lib64/libasan.so.2+0x9896a) #1 0x7f6884cca8cf in enqueue_built_in_kernels() /home/fd/git/beignet/utests/enqueue_built_in_kernels.cpp:12 #2 0x7f6885047617 (/home/fd/git/beignet/build/utests/libutests.so+0x4b2617)