#include "EXTERN.h" #include "perl.h" #include "XSUB.h" struct s { int field1; int field2; int field3; }; void do_simulation() { int i; struct s * m = (struct s*)malloc(10000000 * sizeof(struct s)); for (i=0; i<10000000; i++) { m[i].field1 = 0; m[i].field2 = 1; m[i].field3 = 2; } /* sleep for 5 seconds to be able to analyze memory usage sleep(5); free(m); /* sleep for 5 seconds to be able to see if memory is freed sleep(5); } int main(void) { do_simulation(); return 1; }