diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-04-02 12:02:24 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-04-02 12:02:24 +0200 |
| commit | 3f0225c2dffc2c5cf6887cb93f44cf8a1dd888c3 (patch) | |
| tree | 15347c1d827ba16709ffa118fe1d3fd09e0c4c2b /src/benchmarks/realloc/realloc.c | |
| parent | 5bcc88fb9131884edd545af1f085c043cf34166a (diff) | |
| download | allocbench-3f0225c2dffc2c5cf6887cb93f44cf8a1dd888c3.tar.gz allocbench-3f0225c2dffc2c5cf6887cb93f44cf8a1dd888c3.zip | |
add real simple realloc benchmark
Diffstat (limited to 'src/benchmarks/realloc/realloc.c')
| -rw-r--r-- | src/benchmarks/realloc/realloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/benchmarks/realloc/realloc.c b/src/benchmarks/realloc/realloc.c new file mode 100644 index 0000000..2eddc26 --- /dev/null +++ b/src/benchmarks/realloc/realloc.c @@ -0,0 +1,14 @@ +#include <stdlib.h> +#include <stdio.h> + +size_t* array; +size_t steps = 1; +int main() { + for (int i = 0; i < 100; i++) { + if ((array = realloc(array, sizeof(size_t) * steps * i)) == NULL) { + perror("realloc"); + return 1; + } + } + return 0; +} |
