#include #include #include #include struct Node { int data; struct Node *next; }; typedef struct Node *List; List create(size_t size) { if (size==0) { return NULL; } List first = (List) malloc(sizeof(struct Node)); first->data = size; first->next = create(size-1); return first; } void erase(List *l) { if (*l) { erase(&((*l)->next)); free(*l); *l = NULL; } } int main() { struct rlimit r; r.rlim_cur = -1; r.rlim_max = -1; setrlimit(RLIMIT_STACK, &r); size_t N = 100000000; List l = create(N); printf("Created\n"); erase(&l); printf("Erased\n"); return EXIT_SUCCESS; }