#include <err.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static void *
start(void *cookie)
{
	char buf[] = "GC-marker-NNN";

	snprintf(buf, sizeof buf, "GC-marker-%u", (unsigned)(uintptr_t)cookie);
	free(strdup(buf));

	return NULL;
}

int
main(void)
{
	pthread_t t[24];
	unsigned i;
	int error;

	for (i = 0; i < __arraycount(t); i++) {
		error = pthread_create(&t[i], NULL, &start,
		    (void *)(uintptr_t)i);
		if (error)
			errc(1, error, "pthread_create");
	}
	for (i = 0; i < __arraycount(t); i++) {
		error = pthread_join(t[i], NULL);
		if (error)
			errc(1, error, "pthread_join");
	}
	return 0;
}