I think that the leak is at C<Parrot_PCCINVOKE>. I tested it that way:
test.pmc ======== #include "parrot/parrot.h" pmclass Test dynpmc group pjs_group hll Pjs { void set_integer_native(INTVAL ignore) { int i; for(i=0;i<10000000;i++) { Parrot_PCCINVOKE(INTERP, SELF, string_from_literal(INTERP, "nothing"), "->"); } } PCCMETHOD nothing() { } } test.pir ======== .HLL 'Pjs', 'pjs_group' .sub _ :main .local pmc t t = new 'Test' t = 0 .end I suspect that C<ctx> at C<Parrot_PCCINVOKE> is leaking. I don't know how the context stuff works, but I suppose that C<ctx->ref_count> needs to be 0 before C<ctx> is freed. I'm not sure how to check for this in a proper way. But if I add the next code at the end of C<Parrot_PCCINVOKE> an try out test.pir, it does not print anything and it does not crash, so I think that C<ctx> is not freed. static parrot_context_t *ccc = NULL; if (! ccc) ccc = ctx; if(ccc->ref_count != 1) printf("ref_count = %d\n", ccc->ref_count);