             }
             XCTAssertNil(secondResult)
             XCTAssertNil(thirdResult)
+            localCopy.writeString("foo") // stops the optimiser getting rid of `localCopy`
         }
 
         let fourthResult = buffer.modifyIfUniquelyOwned {

                                        hookedFree: testReserveCapacityLarger_freeHook,
                                        hookedMemcpy: testReserveCapacityLarger_memcpyHook)
        var buf = alloc.buffer(capacity: 16)
        let bufCopy = buf

        withExtendedLifetime(bufCopy) {
            let oldCapacity = buf.capacity

            XCTAssertNotEqual(buf.capacity, oldCapacity)
            XCTAssertNotEqual(oldPtrVal, newPtrVal)
        }
        bufCopy.writeString("foo") // stops the optimiser removing `bufCopy` which would make `reserveCapacity` use malloc instead of realloc
    }

    func testReserveCapacityWithMinimumWritableBytesWhenNotEnoughWritableBytes() {
