File: allocfree.c

package info (click to toggle)
njamd 0.9.3pre2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,704 kB
  • ctags: 1,056
  • sloc: ansic: 9,367; sh: 7,921; makefile: 121; perl: 52
file content (25 lines) | stat: -rwxr-xr-x 400 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char chk_buf[3*4096];

int main()
{
	int i;
	char *buf;
	memset(chk_buf, 1, sizeof(chk_buf));
	for(i = 2; i < 3*4096; i++)
	{
//		fprintf(stderr, "Testing %d bytes... ",i);
		buf = malloc(i);
		memset(buf, 1, i);
		free(buf);
		buf = calloc(1, i);
		memset(buf, 1, i);
		free(buf);
//		fprintf(stderr, "Ok.\n");
	}
	return 0;
}
// vim:ts=4