From bead44e18d070e775751cbef286bf6e728bb9a44 Mon Sep 17 00:00:00 2001 From: Sean T Allen Date: Fri, 11 Nov 2016 14:39:03 -0500 Subject: [PATCH] Stop leaking memory during serialization Prior to this commit, serializing a pony object would leak memory. By using "pool alloc" rather than "pony alloc", we were directly allocating memory that would need to be manually freed. What we wanted to do was use "pony alloc" so that the GC would track usage of the memory and free it when needed. --- src/libponyrt/gc/serialise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libponyrt/gc/serialise.c b/src/libponyrt/gc/serialise.c index d8527770b9..6efef596f4 100644 --- a/src/libponyrt/gc/serialise.c +++ b/src/libponyrt/gc/serialise.c @@ -164,7 +164,7 @@ void pony_serialise(pony_ctx_t* ctx, void* p, void* out) ponyint_array_t* r = (ponyint_array_t*)out; r->size = ctx->serialise_size; r->alloc = r->size; - r->ptr = (char*)ponyint_pool_alloc_size(r->size); + r->ptr = (char*)pony_alloc(ctx, r->size); size_t i = HASHMAP_BEGIN; serialise_t* s;