Hello Apple Forum,
We were testing out the following entitlements: 'Increased Memory Limit', 'Extended Virtual Addressing', 'Extended Virtual Addressing(Debug)' when we realized the maximum allocation amount of the memory dropped from our previous test of 32GB to 16GB.
We were testing these on the following devices:
iPad Pro 12.9(6th Gen) 18.4(Beta, 22E4232a)
iPad Pro 11 M4 18.3.2
Each device has 16GB of physical RAM and because we are able to reach 16GB of allocation usage until app crashes, we believe the entitlements are applied correctly. Each test device was on charging mode and battery mode with 60, 80 100% battery.
We understand allocating memory is complex and os is more optimized for battery efficiency, hence possibly limiting max usage of memory.
However, through the same testing method we have done on iPadOS 18.3 and 4, we were able to allocate 31~32GB of RAM on testing done on January this year. (iPadOS 18.0, or maybe 18.1?) which make us wonder, has there been a change in core os that handles memory allocation since 18.0? And what can be the cause of this drop?
The code we ran for our memory testing is as follows:
private var allocatedMemory: [UnsafeMutableRawPointer] = []
public func allocate1GBMemory() {
let sizeInBytes = 1024 * 1024 * 1024
if let pointer = malloc(sizeInBytes) {
for i in 0..<sizeInBytes {
pointer.advanced(by: i).storeBytes(of: UInt8(i % 256), as: UInt8.self)
}
allocatedMemory.append(pointer)
logger.print("Allocated 1GB of memory. Total allocated: \(allocatedMemory.count)GB")
} else {
logger.print("Failed to allocate memory")
}
}
Each functions call increases memory usage by allocating 1GB of space and we have called this function until it reaches 16GB then the app crashes.
Selecting any option will automatically load the page