summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-22 15:14:35 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-22 15:14:35 +0200
commitf2265c357bdd6339632f7e71e1010e901adc028c (patch)
treed2b6acbda1a1545f1896613016c256271da3e244
parent1641912f2c9967b494187e7522d31bb00c53063c (diff)
REPL: Create an autorelease pool in each iteration.
-rw-r--r--MLKReadEvalPrintLoop.m7
1 files changed, 7 insertions, 0 deletions
diff --git a/MLKReadEvalPrintLoop.m b/MLKReadEvalPrintLoop.m
index 1d79a2f..a32f066 100644
--- a/MLKReadEvalPrintLoop.m
+++ b/MLKReadEvalPrintLoop.m
@@ -22,7 +22,9 @@
#import "MLKPackage.h"
#import "MLKReadEvalPrintLoop.h"
#import "MLKReader.h"
+#import "runtime-compatibility.h"
+#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import <editline/history.h>
@@ -68,9 +70,12 @@ static const char *prompt (EditLine *e) {
if (line_length > 0)
{
+ NSAutoreleasePool *pool;
NSString *result;
id code;
+ pool = [[NSAutoreleasePool alloc] init];
+
history (commands, &event, H_ENTER, line);
code = [MLKReader readFromString:result];
result = [MLKInterpreter eval:code
@@ -78,6 +83,8 @@ static const char *prompt (EditLine *e) {
globalContext]
withEnvironment:[MLKLexicalEnvironment
globalEnvironment]];
+
+ RELEASE (pool);
}
//free (line);