Skip to content

Instantly share code, notes, and snippets.

@waj
Created January 28, 2014 20:28
Show Gist options
  • Save waj/8675658 to your computer and use it in GitHub Desktop.
Save waj/8675658 to your computer and use it in GitHub Desktop.
Segfault using GC and PCL
#include <gc/gc.h>
#include <pcl.h>
#include <stdio.h>
void coroutine(void *arg)
{
int i;
for (i = 0; i < 1000; ++i)
{
printf("%d\n", i);
GC_malloc(1024);
}
}
#define STACK_SIZE 32 * 1024
int main(int argc, char const *argv[])
{
GC_init();
void *stack = GC_malloc(STACK_SIZE);
coroutine_t c = co_create(coroutine, 0, stack, STACK_SIZE);
co_call(c);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment