From 2f826b5305d27a5deb004bc91f52640d89c2f603 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 29 Mar 2013 16:41:05 +0100 Subject: [PATCH] fixes memory leaks concerning closures --- compiler/types.nim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/types.nim b/compiler/types.nim index fe8e03c071..0bd7e2679d 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -346,11 +346,10 @@ proc canFormAcycleAux(marker: var TIntSet, typ: PType, startId: int): bool = #if t.kind == tyObject and tfFinal notin t.flags: # # damn inheritance may introduce cycles: # result = true + of tyProc: result = typ.callConv == ccClosure else: nil -proc canFormAcycle(typ: PType): bool = - # XXX as I expect cycles introduced by closures are very rare, we pretend - # they can't happen here. +proc canFormAcycle(typ: PType): bool = var marker = InitIntSet() result = canFormAcycleAux(marker, typ, typ.id)