Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed memory leaks

  • Loading branch information...
commit 3fe6320f7518d2dfcb3dc7c24b911a13c890874d 1 parent bbddf61
@BYTEPOETS-MBR BYTEPOETS-MBR authored
View
26 Classes/BenchmarkTest.m
@@ -67,6 +67,13 @@ @implementation BenchmarkTest
@synthesize collection;
+- (void) dealloc
+{
+ [collection release]; collection = nil;
+ [super dealloc];
+}
+
+
- (void)prepareData
{
NSAssert(NO, @"BenchmarkTest - prepareData: implement in subclass!");
@@ -185,7 +192,7 @@ + (void)runBenchmarksWithCollection:(id)theCollection
&& [benchmarkClass isInheritedFromClass:[BenchmarkTest class]])
{
// run benchmark with class
- BenchmarkTest<BenchmarkTestProtocol> *benchmarkObject = [[benchmarkClass alloc] init];
+ BenchmarkTest<BenchmarkTestProtocol> *benchmarkObject = [[[benchmarkClass alloc] init] autorelease];
benchmarkObject.collection = theCollection;
[benchmarkObject prepareData];
@@ -245,17 +252,20 @@ + (void)runBenchmarksWithCollection:(id)theCollection
{
// reset BenchmarkProgressViewController
[[BenchmarkProgressViewController instance] resetBenchmark];
- return;
+
}
-
- UINavigationController *navigationController = [BenchmarkProgressViewController instance].navigationController;
- JBResultsViewController *viewController = [[JBResultsViewController alloc] init];
- [navigationController pushViewController:viewController animated:YES];
+ else
+ {
+ UINavigationController *navigationController = [BenchmarkProgressViewController instance].navigationController;
+ JBResultsViewController *viewController = [[JBResultsViewController alloc] init];
+ [navigationController pushViewController:viewController animated:YES];
- [[NSNotificationCenter defaultCenter] postNotificationName:JBDidFinishBenchmarksNotification object:allResults];
- [viewController release];
+ [[NSNotificationCenter defaultCenter] postNotificationName:JBDidFinishBenchmarksNotification object:allResults];
+ [viewController release];
+ }
});
});
+ dispatch_release(benchmarkQueue);
}
@end
View
13 Classes/JSONBenchmarkTest.m
@@ -9,7 +9,7 @@
#import "JSONBenchmarkTest.h"
#import "JSONParser.h"
#import "JSONWriter.h"
-
+#import "CJSONDeserializer.h"
@implementation JSONBenchmarkTest
@synthesize JSONData;
@@ -25,7 +25,18 @@ - (void) dealloc
- (void)prepareData
{
NSError *error = nil;
+
+// NSStringEncoding stringEncoding = NSUTF8StringEncoding;
+// NSStringEncoding dataEncoding = stringEncoding; // NSUTF32BigEndianStringEncoding;
+//
+// NSString *jsonString = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"twitter_public_timeline" ofType:@"json"] encoding:stringEncoding error:nil];
+// NSData *jsonData = [jsonString dataUsingEncoding:dataEncoding];
+// self.JSONData = jsonData;
+// self.collection = (NSArray *)[[CJSONDeserializer deserializer] deserialize:jsonData error:nil];
+
self.JSONData = [JSON dataWithObject:self.collection options:0 encoding:NSUTF8StringEncoding error:NULL];
+
+
NSAssert1(error == nil, @"JSONBenchmarkTest - prepareData: error serializing data: %@", error);
}
View
28 JSONBenchmarks.xcodeproj/project.pbxproj
@@ -10,16 +10,16 @@
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+ 870DAA0B131C364300CBEB8C /* JSONFrameworkBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC11A13191444008A7C01 /* JSONFrameworkBenchmarkTest.m */; };
+ 870DAA93131C404B00CBEB8C /* AppleBinaryPlistBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EBFA413181A9A008A7C01 /* AppleBinaryPlistBenchmarkTest.m */; };
+ 870DAA94131C404C00CBEB8C /* AppleJSONBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC117131913C9008A7C01 /* AppleJSONBenchmarkTest.m */; };
+ 870DAA95131C404C00CBEB8C /* AppleXMLPlistBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0C213191000008A7C01 /* AppleXMLPlistBenchmarkTest.m */; };
+ 870DAA96131C404D00CBEB8C /* TouchJSONBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0F7131912AE008A7C01 /* TouchJSONBenchmarkTest.m */; };
+ 870DAA97131C404E00CBEB8C /* JSONKitBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EBFA113181A87008A7C01 /* JSONKitBenchmarkTest.m */; };
+ 870DAA98131C404E00CBEB8C /* YAJLBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0CD1319116A008A7C01 /* YAJLBenchmarkTest.m */; };
874EBF7C131816BA008A7C01 /* BenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EBF7B131816BA008A7C01 /* BenchmarkTest.m */; };
- 874EBFA213181A87008A7C01 /* JSONKitBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EBFA113181A87008A7C01 /* JSONKitBenchmarkTest.m */; };
- 874EBFA513181A9A008A7C01 /* AppleBinaryPlistBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EBFA413181A9A008A7C01 /* AppleBinaryPlistBenchmarkTest.m */; };
874EBFA813181ABF008A7C01 /* JSONBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EBFA713181ABF008A7C01 /* JSONBenchmarkTest.m */; };
874EC0291319046F008A7C01 /* NSObject+Introspection.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0281319046F008A7C01 /* NSObject+Introspection.m */; };
- 874EC0C313191000008A7C01 /* AppleXMLPlistBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0C213191000008A7C01 /* AppleXMLPlistBenchmarkTest.m */; };
- 874EC0CE1319116A008A7C01 /* YAJLBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0CD1319116A008A7C01 /* YAJLBenchmarkTest.m */; };
- 874EC0F8131912AE008A7C01 /* TouchJSONBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC0F7131912AE008A7C01 /* TouchJSONBenchmarkTest.m */; };
- 874EC118131913C9008A7C01 /* AppleJSONBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC117131913C9008A7C01 /* AppleJSONBenchmarkTest.m */; };
- 874EC11B13191444008A7C01 /* JSONFrameworkBenchmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC11A13191444008A7C01 /* JSONFrameworkBenchmarkTest.m */; };
874EC1AB13199457008A7C01 /* BenchmarkProgressViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 874EC1A913199457008A7C01 /* BenchmarkProgressViewController.m */; };
874EC1AC13199457008A7C01 /* BenchmarkProgressViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 874EC1AA13199457008A7C01 /* BenchmarkProgressViewController.xib */; };
B20294AF123C9D4500D64200 /* JBResultsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B20294AE123C9D4500D64200 /* JBResultsViewController.m */; };
@@ -605,16 +605,16 @@
BC3BAB8012B57A070099F494 /* SBJsonStreamWriterState.m in Sources */,
BC3BAB8112B57A070099F494 /* SBJsonTokeniser.m in Sources */,
874EBF7C131816BA008A7C01 /* BenchmarkTest.m in Sources */,
- 874EBFA213181A87008A7C01 /* JSONKitBenchmarkTest.m in Sources */,
- 874EBFA513181A9A008A7C01 /* AppleBinaryPlistBenchmarkTest.m in Sources */,
874EBFA813181ABF008A7C01 /* JSONBenchmarkTest.m in Sources */,
874EC0291319046F008A7C01 /* NSObject+Introspection.m in Sources */,
- 874EC0C313191000008A7C01 /* AppleXMLPlistBenchmarkTest.m in Sources */,
- 874EC0CE1319116A008A7C01 /* YAJLBenchmarkTest.m in Sources */,
- 874EC0F8131912AE008A7C01 /* TouchJSONBenchmarkTest.m in Sources */,
- 874EC118131913C9008A7C01 /* AppleJSONBenchmarkTest.m in Sources */,
- 874EC11B13191444008A7C01 /* JSONFrameworkBenchmarkTest.m in Sources */,
874EC1AB13199457008A7C01 /* BenchmarkProgressViewController.m in Sources */,
+ 870DAA0B131C364300CBEB8C /* JSONFrameworkBenchmarkTest.m in Sources */,
+ 870DAA93131C404B00CBEB8C /* AppleBinaryPlistBenchmarkTest.m in Sources */,
+ 870DAA94131C404C00CBEB8C /* AppleJSONBenchmarkTest.m in Sources */,
+ 870DAA95131C404C00CBEB8C /* AppleXMLPlistBenchmarkTest.m in Sources */,
+ 870DAA96131C404D00CBEB8C /* TouchJSONBenchmarkTest.m in Sources */,
+ 870DAA97131C404E00CBEB8C /* JSONKitBenchmarkTest.m in Sources */,
+ 870DAA98131C404E00CBEB8C /* YAJLBenchmarkTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Please sign in to comment.
Something went wrong with that request. Please try again.