Created
January 28, 2014 20:28
-
-
Save waj/8675658 to your computer and use it in GitHub Desktop.
Segfault using GC and PCL
This file contains hidden or 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
#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