Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f209afd
First attempt to improve precision for multi-threaded valid-memcleanup
mrstanb Nov 16, 2023
c0fe89e
Add regr. test cases for multi-threaded valid-memcleanup
mrstanb Nov 16, 2023
7289ec3
Use solely local state for multi-threaded valid-memcleanup
mrstanb Nov 18, 2023
720cfee
IsMallocCalled should be `may`
michael-schwarz Nov 19, 2023
af9ddc7
Add unsound example
michael-schwarz Nov 19, 2023
0655fd6
Merge branch 'master' into improve-multi-threaded-valid-memcleanup
michael-schwarz Nov 19, 2023
ada8491
Make sound by accounting for alloc in global invariant
michael-schwarz Nov 19, 2023
e7d6302
Cleanup
michael-schwarz Nov 19, 2023
e6cee27
Fix `memtrack` for multi-threaded case
michael-schwarz Nov 19, 2023
97eb715
Account for failing assertions in the multi-threaded case as well
mrstanb Nov 19, 2023
987795e
Add a few more test cases
mrstanb Nov 19, 2023
8d55024
Add options to produce warnings only for memory leaks
mrstanb Nov 19, 2023
ca61360
Add example where better privatization helps
michael-schwarz Nov 21, 2023
2cc915f
Check at end of main thread that the program is certainly single-thre…
jerhard Nov 21, 2023
45ec8a6
Add test case for memory leaking from a thead that is not joined, add…
jerhard Nov 21, 2023
56c4d62
Add test case with pthread_exit called in main, remove threadid analy…
jerhard Nov 21, 2023
2fef812
Add testcases for thread return and pthread_exit in thread different …
jerhard Nov 21, 2023
645b03c
ThreadAnalysis: Handle pthread_exit like return from thread.
jerhard Nov 21, 2023
c6cb63e
Update tests/regression/76-memleak/16-no-mem-leak-thread-exit-main.c
jerhard Nov 22, 2023
f12a392
Remove call to free.
jerhard Nov 22, 2023
be9171b
Add annotation of nowarn next to pthread_exit.
jerhard Nov 22, 2023
585a65d
Check in TheadAnalysis.return whether the return is actually a thread…
jerhard Nov 22, 2023
bc7694b
Add test case that checking that analysis distinguishes between threa…
jerhard Nov 22, 2023
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread --set ana.activated[+] threadid
#include <stdlib.h>
#include <pthread.h>

Expand All @@ -7,6 +7,7 @@ int *m1;

void *f1(void *arg) {
m1 = malloc(sizeof(int));
free(m1);
// Thread t1 leaks m1 here
pthread_exit(NULL); //WARN
}
Expand All @@ -28,6 +29,9 @@ int main(int argc, char const *argv[]) {

free(g);

pthread_join(t1, NULL);
pthread_join(t2, NULL);

// main thread is not leaking anything
return 0; //NOWARN
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread --set ana.activated[+] threadid
#include <stdlib.h>
#include <pthread.h>

Expand All @@ -25,9 +25,12 @@ int main(int argc, char const *argv[]) {

pthread_t t2;
pthread_create(&t2, NULL, f2, NULL);

free(g);

pthread_join(t1, NULL);
pthread_join(t2, NULL);

// main thread is not leaking anything
return 0; //NOWARN
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.base.privatization mutex-meet-tid --set ana.path_sens[+] threadflag
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.base.privatization mutex-meet-tid --set ana.path_sens[+] threadflag --set ana.activated[+] thread --set ana.activated[+] threadid
#include <stdlib.h>
#include <pthread.h>

Expand Down Expand Up @@ -28,6 +28,9 @@ int main(int argc, char const *argv[]) {

free(g);

pthread_join(t1, NULL);
pthread_join(t2, NULL);

// main thread is not leaking anything
return 0; //NOWARN
}
18 changes: 18 additions & 0 deletions tests/regression/76-memleak/15-mem-leak-not-joined-thread.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread --set ana.activated[+] threadid
#include <stdlib.h>
#include <pthread.h>

int *m1;

void *f1(void *arg) {
m1 = malloc(sizeof(int));
while (1);
}

int main(int argc, char const *argv[]) {
pthread_t t1;
pthread_create(&t1, NULL, f1, NULL);

// memory from thread f1 which was not joined into main, is not freed
return 0; //WARN
}