cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject ios commit: [CB-4567] fix issue: "Benchmarks" ->"AutoBench" crashed on iOS
Date Tue, 27 Aug 2013 15:15:31 GMT
Updated Branches:
  refs/heads/3.0.x 8c50ee2a8 -> 974deafdd


[CB-4567] fix issue: "Benchmarks" ->"AutoBench" crashed on iOS

The problem seems to be that a lot of autoreleased objects fill up the
memory waiting to be released. So a solution is to add autorelease pool
scope to collect autoreleased objects and release them sooner.

FYI:http://stackoverflow.com/questions/13396560/cant-allocate-region-mal
loc-error-when-running-millions-of-iterations-of-loop


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/974deafd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/974deafd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/974deafd

Branch: refs/heads/3.0.x
Commit: 974deafdd5267c56eb6dbf7e968047e4407f0ad2
Parents: 8c50ee2
Author: lmnbeyond <lmmbeyond@gmail.com>
Authored: Thu Aug 15 10:30:11 2013 +0800
Committer: Max Woghiren <max.woghiren@gmail.com>
Committed: Tue Aug 27 11:15:10 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCommandQueue.m | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/974deafd/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index 710e463..6af31c8 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -102,19 +102,21 @@
 
             // Iterate over and execute all of the commands.
             for (NSArray* jsonEntry in commandBatch) {
-                CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
-                CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className,
command.methodName);
+                @autoreleasepool {
+                    CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
+                    CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className,
command.methodName);
 
-                if (![self execute:command]) {
+                    if (![self execute:command]) {
 #ifdef DEBUG
-                        NSString* commandJson = [jsonEntry JSONString];
-                        static NSUInteger maxLogLength = 1024;
-                        NSString* commandString = ([commandJson length] > maxLogLength)
?
-                            [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]]
:
-                            commandJson;
+                            NSString* commandJson = [jsonEntry JSONString];
+                            static NSUInteger maxLogLength = 1024;
+                            NSString* commandString = ([commandJson length] > maxLogLength)
?
+                                [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]]
:
+                                commandJson;
 
-                        DLog(@"FAILED pluginJSON = %@", commandString);
+                            DLog(@"FAILED pluginJSON = %@", commandString);
 #endif
+                    }
                 }
             }
         }


Mime
View raw message