Post

Replies

Boosts

Views

Activity

Reply to Could please better understand what is problems with AddressSanitizer: allocator is out of memory?
I found this by searching for "AddressSanitizer: allocator is out of memory trying to allocate" I have turned on Address Sanitizer. I know I am having memory problems. I want to find where My problem is there is what looks like a stack trace output, but it is not including any code I wrote. Where can I get a useful stack trace? How can I profile allocations to find the offending allocation? 2021-08-12 09:12:07.313295+1200 B52FloorManagement[526:176200] #0 0x1082f4db4 in __sanitizer_mz_calloc+0x8c (/private/var/containers/Bundle/Application/31C1D5A3-40AB-4C5D-8B1B-6E3D2692BFEF/B52FloorManagement.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib:arm64e+0x40db4) 2021-08-12 09:12:07.313351+1200 B52FloorManagement[526:176200] #1 0x1a14aba9c in <redacted>+0x54 (/usr/lib/system/libsystem_malloc.dylib:arm64e+0x12a9c) 2021-08-12 09:12:07.313398+1200 B52FloorManagement[526:176200] #2 0x1938f9fe4 in <redacted>+0xf8 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x1e7fe4) 2021-08-12 09:12:07.313442+1200 B52FloorManagement[526:176200] #3 0x1938f8eec in <redacted>+0x1cec (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x1e6eec) 2021-08-12 09:12:07.313489+1200 B52FloorManagement[526:176200] #4 0x1938f5720 in <redacted>+0x424 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x1e3720) 2021-08-12 09:12:07.313532+1200 B52FloorManagement[526:176200] #5 0x1937142b8 in <redacted>+0x2c8 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x22b8) 2021-08-12 09:12:07.313607+1200 B52FloorManagement[526:176200] #6 0x193916258 in <redacted>+0x47c (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x204258) 2021-08-12 09:12:07.313873+1200 B52FloorManagement[526:176200] #7 0x193980e24 in <redacted>+0x2d8 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x26ee24) 2021-08-12 09:12:07.314147+1200 B52FloorManagement[526:176200] #8 0x1938b23c8 in CGDisplayListDrawInContextDelegate+0x1c4 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x1a03c8) 2021-08-12 09:12:07.314393+1200 B52FloorManagement[526:176200] #9 0x19374b86c in <redacted>+0x704 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x3986c) 2021-08-12 09:12:07.314634+1200 B52FloorManagement[526:176200] #10 0x19374b130 in <redacted>+0x34 (/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics:arm64e+0x39130) 2021-08-12 09:12:07.314837+1200 B52FloorManagement[526:176200] #11 0x19441ae18 in <redacted>+0x24 (/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore:arm64e+0x76fe18) 2021-08-12 09:12:07.314985+1200 B52FloorManagement[526:176200] #12 0x19441b8cc in <redacted>+0x24 (/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore:arm64e+0x7708cc) 2021-08-12 09:12:07.315161+1200 B52FloorManagement[526:176200] #13 0x19441e2d4 in <redacted>+0x1d0 (/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore:arm64e+0x7732d4) 2021-08-12 09:12:07.315403+1200 B52FloorManagement[526:176200] #14 0x19441e0cc in <redacted>+0x78 (/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore:arm64e+0x7730cc) 2021-08-12 09:12:07.315536+1200 B52FloorManagement[526:176200] #15 0x19441b80c in <redacted>+0xc0 (/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore:arm64e+0x77080c) 2021-08-12 09:12:07.315679+1200 B52FloorManagement[526:176200] #16 0x105ffee80 in $s18B52FloorManagement24createQCIScreenShotImageSo7UIImageCyF+0x938 (/private/var/containers/Bundle/Application/31C1D5A3-40AB-4C5D-8B1B-6E3D2692BFEF/B52FloorManagement.app/B52FloorManagement:arm64+0x1010e2e80) 2021-08-12 09:12:07.315855+1200 B52FloorManagement[526:176200] #17 0x105a41be4 in $s18B52FloorManagement18DialogMainMoreMenuV17createLayoutImageyyF13_layoutImagesL_yyF+0x1264 (/private/var/containers/Bundle/Application/31C1D5A3-40AB-4C5D-8B1B-6E3D2692BFEF/B52FloorManagement.app/B52FloorManagement:arm64+0x100b25be4) 2021-08-12 09:12:07.316102+1200 B52FloorManagement[526:176200] #18 0x105ecb9b4 in $s18B52FloorManagement11CoordinatorC4draw2inySo7MTKViewC_tF+0x598 (/private/var/containers/Bundle/Application/31C1D5A3-40AB-4C5D-8B1B-6E3D2692BFEF/B52FloorManagement.app/B52FloorManagement:arm64+0x100faf9b4) 2021-08-12 09:12:07.316304+1200 B52FloorManagement[526:176200] #19 0x105ecc364 in $s18B52FloorManagement11CoordinatorC4draw2inySo7MTKViewC_tFTo+0x84 (/private/var/containers/Bundle/Application/31C1D5A3-40AB-4C5D-8B1B-6E3D2692BFEF/B52FloorManagement.app/B52FloorManagement:arm64+0x100fb0364) 2021-08-12 09:12:07.316433+1200 B52FloorManagement[526:176200] #20 0x1c474779c in <redacted>+0xb4 (/System/Library/Frameworks/MetalKit.framework/MetalKit:arm64e+0x1379c) 2021-08-12 09:12:07.316637+1200 B52FloorManagement[526:176200] #21 0x1c4743d10 in <redacted>+0x24 (/System/Library/Frameworks/MetalKit.framework/MetalKit:arm64e+0xfd10) 2021-08-12 09:12:07.316826+1200 B52FloorManagement[526:176200] #22 0x10967fd6c in -[DYDisplayLinkInterposer forwardDisplayLinkCallback:]+0xa8 (/Developer/Library/PrivateFrameworks/GPUToolsCore.framework/GPUToolsCore:arm64e+0x13d6c) 2021-08-12 09:12:07.316964+1200 B52FloorManagement[526:176200] #23 0x1950ea7b4 in <redacted>+0x29c (/System/Library/Frameworks/QuartzCore.framework/QuartzCore:arm64e+0x147b4) 2021-08-12 09:12:07.317103+1200 B52FloorManagement[526:176200] #24 0x1951c97f0 in <redacted>+0x114 (/System/Library/Frameworks/QuartzCore.framework/QuartzCore:arm64e+0xf37f0) 2021-08-12 09:12:07.317252+1200 B52FloorManagement[526:176200] #25 0x191ddca58 in <redacted>+0xac (/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation:arm64e+0x7ea58) 2021-08-12 09:12:07.317406+1200 B52FloorManagement[526:176200] #26 0x191e02270 in <redacted>+0x38 (/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation:arm64e+0xa4270) 2021-08-12 09:12:07.317549+1200 B52FloorManagement[526:176200] #27 0x191e015f0 in <redacted>+0x250 (/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation:arm64e+0xa35f0) 2021-08-12 09:12:07.317747+1200 B52FloorManagement[526:176200] #28 0x191dfb1d4 in <redacted>+0x940 (/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation:arm64e+0x9d1d4) 2021-08-12 09:12:07.317903+1200 B52FloorManagement[526:176200] #29 0x191dfa35c in CFRunLoopRunSpecific+0x254 (/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation:arm64e+0x9c35c) 2021-08-12 09:12:07.318266+1200 B52FloorManagement[526:176200]
Aug ’21
Reply to What are the meanings of the fields in mach_task_basic_info()
I found this: #define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */ struct mach_task_basic_info { mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ mach_vm_size_t resident_size; /* resident memory size (bytes) */ mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */ time_value_t user_time; /* total user run time for * terminated threads */ time_value_t system_time; /* total system run time for * terminated threads */ policy_t policy; /* default policy for new threads */ integer_t suspend_count; /* suspend count for task */ }; This is in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer//SDKs/MacOSX.sdk/usr/include/mach/task_info.h
Nov ’21
Reply to how XCode to calculate Memory
memoryFootprint is quite confusing code but useful. Putting it in the debugger and studying info (at line return info.phys_footprint) I see it has a field limit_bytes_remaining Is this a useful guideline as to how much memory is available for allocation? I notice that when UIGraphicsBeginImageContextWithOptions(size,....) fails with a message "Cannot allocate X bytes" X is 16 x size.width x size.height I would like to know if UIGraphicsBeginImageContextWithOptions will fail before I call it and crash
Dec ’21
Reply to Core ML on iOS 15 consumes much larger memory for prediction
How did you get that to compile? os_proc_available_memory() foro me is unknown I import OS and in the bridging header #include <os/proc.h> I get an error in ios15/usr/include/sys/cdefs.h /* * Architecture validation for current SDK */ #if !defined(__sys_cdefs_arch_unknown__) && defined(__arm__) #elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm64__) #else #error Unsupported architecture #endif Clearly __arm__ and __arm64__ are not defined or __sys_cdefs_arch_unknown__ is... I am out of my depth!
Dec ’21
Reply to how XCode to calculate Memory
#include <os/proc.h> in the bridging header works on a test app I built. In my project there is a lot of metal code. There is already a Bridging Header to facilitate that. (It defines a lot of C structures. Not my area of the code) When I add #include <os/proc.h> to that header the build fails withe error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include/sys/cdefs.h:825:2: Unsupported architecture in cdefs.h #if !defined(__sys_cdefs_arch_unknown__) && defined(__arm__) #elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm64__) #else #error Unsupported architecture #endif There are at least six os/proc.h files on my Mac picking one at random I see: * If you need more information than just the available memory, you can use task_info(). * The information returned is equivalent to the task_vm_info.limit_bytes_remaining * field. task_info() is a more expensive call, and will return information such * as your phys_footprint, which is used to calculate the return of this function. This seems to mean that I could substitute the code you supplied above which does some magic and returns task_vm_info_data_t.limit_bytes_remaining? You recommend against this but the value returned in a simple test is the same.
Dec ’21
Reply to UIActivityViewController: Changing default file name
Save the file to the bundle let DocumentDirURL = try! FileManager.default.url(.. ) // Now the file itself. Create the name let fileURL = DocumentDirURL.appendingPathComponent( name, // <-- New name of file isDirectory: false ) // Create the file if !FileManager.default.createFile( atPath: fileURL.path, contents: nil, attributes: nil )... if let fileHandle = FileHandle(forWritingAtPath: fileURL.path){ // Write file using fileHandle } Then share the fileURL it will have the name
Jan ’22