forked from ivmai/bdwgc
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2011-07-26 Ivan Maidanski <[email protected]>
* tests/realloc_test.c: New file. * tests/tests.am (TESTS, check_PROGRAMS): Add realloc_test. * .cvsignore: Add realloc_test. * configure: Regenerate. * Makefile.in: Ditto.
- Loading branch information
Showing
6 changed files
with
84 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ initsecondarythread | |
leaktest | ||
libtool | ||
middletest | ||
realloc_test | ||
setjmp_test | ||
smashtest | ||
staticrootstest | ||
|
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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
2011-07-26 Ivan Maidanski <[email protected]> | ||
|
||
* tests/realloc_test.c: New file. | ||
* tests/tests.am (TESTS, check_PROGRAMS): Add realloc_test. | ||
* .cvsignore: Add realloc_test. | ||
* configure: Regenerate. | ||
* Makefile.in: Ditto. | ||
|
||
2011-07-14 Ivan Maidanski <[email protected]> | ||
|
||
* .cvsignore: Add more auto-generated files. | ||
|
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
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,34 @@ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "gc.h" | ||
|
||
#define COUNT 10000000 | ||
|
||
int main(void) { | ||
int i; | ||
unsigned long last_heap_size = 0; | ||
|
||
GC_INIT(); | ||
|
||
for (i = 0; i < COUNT; i++) { | ||
int **p = GC_MALLOC(sizeof(int *)); | ||
int *q = GC_MALLOC_ATOMIC(sizeof(int)); | ||
|
||
if (*p != 0) { | ||
fprintf(stderr, "GC_malloc returned garbage\n"); | ||
exit(1); | ||
} | ||
|
||
*p = GC_REALLOC(q, 2 * sizeof(int)); | ||
|
||
if (i % 10 == 0) { | ||
unsigned long heap_size = (unsigned long)GC_get_heap_size(); | ||
if (heap_size != last_heap_size) { | ||
printf("Heap size: %lu\n", heap_size); | ||
last_heap_size = heap_size; | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
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