-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test accessrecorder with leaky code, fixes #45
- Loading branch information
Showing
3 changed files
with
87 additions
and
3 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
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,38 @@ | ||
// RUN: %run %s -o -O3 2>&1 | FileCheck %s | ||
// REQUIRED: softcounter | ||
|
||
#include <stdlib.h> | ||
|
||
int main(void) { | ||
for (int i = 1; i <= 5; ++i) { | ||
// 5 heap alloc and free: one single double, and then arrays | ||
// max heap (concurrently) 1 | ||
double* d = (double*)malloc(i * sizeof(double)); | ||
free(d); | ||
} | ||
return 0; | ||
} | ||
|
||
// CHECK: Alloc Stats from softcounters | ||
// CHECK-NEXT: Total heap : 5 , 4 , - | ||
// CHECK-NEXT: Total stack : 0 , 0 , - | ||
// CHECK-NEXT: Total global : 0 , 0 , - | ||
// CHECK-NEXT: Max. Heap Allocs : 1 , - , - | ||
// CHECK-NEXT: Max. Stack Allocs : 0 , - , - | ||
// CHECK-NEXT: Addresses checked : 0 , - , - | ||
// CHECK-NEXT: Distinct Addresses checked : 0 , - , - | ||
// CHECK-NEXT: Addresses re-used : 0 , - , - | ||
// CHECK-NEXT: Addresses missed : 0 , - , - | ||
// CHECK-NEXT: Distinct Addresses missed : 0 , - , - | ||
// CHECK-NEXT: Total free heap : 5 , 4 , - | ||
// CHECK-NEXT: Total free stack : 0 , 0 , - | ||
// CHECK-NEXT: Null/Zero/NullZero Addr : 0 , 0 , 0 | ||
// CHECK-NEXT: User-def. types : 0 , - , - | ||
// CHECK-NEXT: Estimated memory use (KiB) : 4 , - , - | ||
// CHECK-NEXT: Bytes per node map/stack : 96 , 8 , - | ||
// CHECK-NEXT: {{(#|-)+}} | ||
// CHECK-NEXT: Allocation type detail (heap, stack, global) | ||
// CHECK-NEXT: 6 : 5 , 0 , 0 , double | ||
// CHECK-NEXT: {{(#|-)+}} | ||
// CHECK-NEXT: Free allocation type detail (heap, stack) | ||
// CHECK-NEXT: 6 : 5 , 0 , double |
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,38 @@ | ||
// RUN: %run %s -o -O1 2>&1 | FileCheck %s | ||
// REQUIRED: softcounter | ||
|
||
#include <stdlib.h> | ||
|
||
int main(void) { | ||
for (int i = 1; i <= 6; ++i) { | ||
// 6 heap alloc | ||
// max heap (concurrently) 6 | ||
double* d = (double*)malloc(sizeof(double)); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
// CHECK: Alloc Stats from softcounters | ||
// CHECK-NEXT: Total heap : 6 , 0 , - | ||
// CHECK-NEXT: Total stack : 0 , 0 , - | ||
// CHECK-NEXT: Total global : 0 , 0 , - | ||
// CHECK-NEXT: Max. Heap Allocs : 6 , - , - | ||
// CHECK-NEXT: Max. Stack Allocs : 0 , - , - | ||
// CHECK-NEXT: Addresses checked : 0 , - , - | ||
// CHECK-NEXT: Distinct Addresses checked : 0 , - , - | ||
// CHECK-NEXT: Addresses re-used : 0 , - , - | ||
// CHECK-NEXT: Addresses missed : 0 , - , - | ||
// CHECK-NEXT: Distinct Addresses missed : 0 , - , - | ||
// CHECK-NEXT: Total free heap : 0 , 0 , - | ||
// CHECK-NEXT: Total free stack : 0 , 0 , - | ||
// CHECK-NEXT: Null/Zero/NullZero Addr : 0 , 0 , 0 | ||
// CHECK-NEXT: User-def. types : 0 , - , - | ||
// CHECK-NEXT: Estimated memory use (KiB) : {{[4-9]}} , - , - | ||
// CHECK-NEXT: Bytes per node map/stack : 96 , 8 , - | ||
// CHECK-NEXT: {{(#|-)+}} | ||
// CHECK-NEXT: Allocation type detail (heap, stack, global) | ||
// CHECK-NEXT: 6 : 6 , 0 , 0 , double | ||
// CHECK-NEXT: {{(#|-)+}} | ||
// CHECK-NEXT: Free allocation type detail (heap, stack) | ||
// CHECK-NEXT: 6 : 0 , 0 , double |