changeset 121:1af91ceaaf49

Fixed memory leak when an output is only attached to a single null input
author Mike Pavone <pavone@retrodev.com>
date Thu, 28 Oct 2010 21:04:12 -0400
parents cd25171e1bb2
children 7361d70fbba6
files nworker_c.rhope
diffstat 1 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/nworker_c.rhope	Thu Oct 21 23:55:15 2010 -0400
+++ b/nworker_c.rhope	Thu Oct 28 21:04:12 2010 -0400
@@ -977,18 +977,28 @@
 	node <- [[worker]Nodes >>]Index[index]
 	dests <- [[node]Wires From >>]Index[io num] {}
 
-	If[[[dests]Length] = [1]]
+	,normal <- If[[[dests]Length] = [1]]
 	{
-		dest index <- [[dests]Index[0]]Index >>
-		dest node <- [[worker]Nodes >>]Index[dest index]
-		
-		[[dest node]Conditions >>]For Backend
+		[dests]Index[0]
+		{
+			dest index <- [~]Index >>
+			dest IO <- [~]IO Num >>
+		}
+		normal <- If[[dest IO] = [-1]] {}
 		{
-			out <- [func]Do If[AndCond[NotCond[~], name],  [[func]Instruction Stream]Release[name]]
-		}{
-			out <- func
+			dest node <- [[worker]Nodes >>]Index[dest index]
+			
+			[[dest node]Conditions >>]For Backend
+			{
+				out <- [func]Do If[AndCond[NotCond[~], name],  [[func]Instruction Stream]Release[name]]
+			}{
+				out <- func
+			}
 		}
-	}{
+	}
+
+	Val[normal]
+	{
 		do if <- If[[[node]Outputs >>] > [1]] {}
 		{
 			do if <- [[node]Conditions >>]Empty? {}