Skip to content

Commit

Permalink
- ios-sdk: update to fix/fp-memory branch to reduce memory consumptio…
Browse files Browse the repository at this point in the history
…n further

- FileProviderExtension: remove CrashReporter framework to lower memory consumption
- ownCloud File Provider.xcscheme: remove stack logging debug option to lower memory consumption enough to make the extension actually debuggable again
  • Loading branch information
felix-schwarz authored and hosy committed Sep 19, 2024
1 parent ea52e9e commit e047879
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 62 deletions.
34 changes: 0 additions & 34 deletions ownCloud File Provider/FileProviderExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#import "NSError+MessageResolution.h"
#import "FileProviderServiceSource.h"
#import "FileProviderContentEnumerator.h"
#import <CrashReporter.h>

@interface FileProviderExtension ()
{
Expand All @@ -62,8 +61,6 @@ @implementation FileProviderExtension

- (instancetype)init
{
[self setupCrashReporting];

[OCLogger logLevel]; // Make sure +logLevel is called in File Provider, to properly set up the log level

NSDictionary *bundleInfoDict = [[NSBundle bundleForClass:[FileProviderExtension class]] infoDictionary];
Expand Down Expand Up @@ -107,37 +104,6 @@ - (OCVFSCore *)vfsCore
return (_vfsCore);
}

- (void)setupCrashReporting {

static dispatch_once_t token;

dispatch_once (&token, ^{
// Initialize crash reporter as soon as FP extension is loaded into memory
PLCrashReporterConfig *configuration = [PLCrashReporterConfig defaultConfiguration];
PLCrashReporter *reporter = [[PLCrashReporter alloc] initWithConfiguration:configuration];

// Do we have a pending crash report from previous session?
if ([reporter hasPendingCrashReport]) {

// Generate a report and add it to the log file
NSData *crashData = [reporter loadPendingCrashReportData];
if (crashData != nil) {
PLCrashReport *report = [[PLCrashReport alloc] initWithData:crashData error:nil];
if (report != nil) {
NSString *crashString = [PLCrashReportTextFormatter stringValueForCrashReport:report withTextFormat:PLCrashReportTextFormatiOS];
OCTLogError(@[@"CRASH_REPORTER"], @"%@", crashString);
}
}

// Purge the report which we just added to the log
[reporter purgePendingCrashReport];
}

// Start intercepting OS signals to catch crashes
[reporter enableCrashReporter];
});
}

- (void)dealloc
{
OCLogDebug(@"Deallocating FileProvider %@", self);
Expand Down
2 changes: 0 additions & 2 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
025FC745247EF0F1009307A7 /* BackgroundUploadsSettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025FC744247EF0F1009307A7 /* BackgroundUploadsSettingsSection.swift */; };
02633EFF2483D2EB00B5F58F /* UNUserNotificationCenter+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02633EFE2483D2EB00B5F58F /* UNUserNotificationCenter+Extensions.swift */; };
0287DD7D249131E000C912CA /* AppStatistics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0287DD7C249131E000C912CA /* AppStatistics.swift */; };
02AE32E424D2FA8B00A19476 /* CrashReporter in Frameworks */ = {isa = PBXBuildFile; productRef = 02AE32E324D2FA8B00A19476 /* CrashReporter */; };
02D4C82A255208E60000E299 /* PDFSearchResultsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D4C829255208E60000E299 /* PDFSearchResultsView.swift */; };
02DC7C9024CB354800DCB2C6 /* ProPhotoUploadSettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DC7C8F24CB354800DCB2C6 /* ProPhotoUploadSettingsSection.swift */; };
232F7CAF2097260400EE22E4 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232F7CAE2097260400EE22E4 /* SettingsViewController.swift */; };
Expand Down Expand Up @@ -1782,7 +1781,6 @@
files = (
DC27A18F20CAA0BA008ACB6C /* ownCloudSDK.framework in Frameworks */,
DC1251EC2C74718B0040FBC6 /* libzip.framework in Frameworks */,
02AE32E424D2FA8B00A19476 /* CrashReporter in Frameworks */,
DC2565EE225F5A1900828AA5 /* UserNotifications.framework in Frameworks */,
DC973BBE24A28ED0001DEEC4 /* CoreServices.framework in Frameworks */,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
launchAutomaticallySubstyle = "2"
queueDebuggingEnabled = "No">
<RemoteRunnable
runnableDebuggingMode = "1"
runnableDebuggingMode = "0"
BundleIdentifier = "com.apple.DocumentsApp"
RemotePath = "/Library/Developer/CoreSimulator/Volumes/iOS_21A342/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/Applications/Files.app">
RemotePath = "/var/containers/Bundle/Application/28D363B8-FA41-4A9B-97F8-5007F7EB81CC/Files.app">
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
Expand Down Expand Up @@ -162,18 +163,6 @@
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
<AdditionalOption
key = "MallocStackLogging"
value = ""
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "PrefersMallocStackLoggingLite"
value = ""
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -183,16 +172,11 @@
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "233BDE9B204FEFE500C06732"
BuildableName = "ownCloud.app"
BlueprintName = "ownCloud"
ReferencedContainer = "container:ownCloud.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<RemoteRunnable
runnableDebuggingMode = "1"
BundleIdentifier = "com.apple.DocumentsApp"
RemotePath = "/Library/Developer/CoreSimulator/Volumes/iOS_22A3351/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.0.simruntime/Contents/Resources/RuntimeRoot/Applications/Files.app">
</RemoteRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down

0 comments on commit e047879

Please sign in to comment.