libs-steptalk/Testing/leaks/leaktest.m
Stefan Urbanek a76195b3fd Added ARP guards
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@17711 72102866-910b-0410-8b05-ffd578937521
2003-09-24 16:52:29 +00:00

40 lines
1.1 KiB
Objective-C

#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSException.h>
#import <StepTalk/StepTalk.h>
int main(void)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *innerPool;
NSString *theScript;
NSString *fname = @"script.st";
STEnvironment *env;
STEngine *engine;
id result;
theScript = [NSString stringWithContentsOfFile:fname];
GSDebugAllocationActive(YES);
NSLog(@"allocated objects on starting script\n%s",GSDebugAllocationList(NO));
env = [STEnvironment defaultScriptingEnvironment];
engine = [STEngine engineForLanguageWithName:@"Smalltalk"];
NS_DURING
//innerPool = [NSAutoreleasePool new];
result = [engine executeCode:theScript inEnvironment:env];
//[innerPool release];
NS_HANDLER
/* handle the exception */
NSLog(@"%@",localException);
NS_ENDHANDLER
//NSLog(@"change of allocated objects\n%s",GSDebugAllocationList(YES));
printf("%s",GSDebugAllocationList(NO));
[pool release];
}