Lines Matching full:memory
22 /// Storage is a container that would hold the memory pointer to solve the issue of
23 /// deallocating the memory that was held by (memory: UnsafeMutableRawPointer)
26 // This storage doesn't own the memory, therefore, we won't deallocate on deinit.
28 /// pointer to the start of the buffer object in memory
29 var memory: UnsafeMutableRawPointer variable
35 memory = UnsafeMutableRawPointer.allocate(byteCount: count, alignment: alignment)
41 init(memory: UnsafeMutableRawPointer, capacity: Int, unowned: Bool) {
42 self.memory = memory
49 memory.deallocate()
58 memory.copyMemory(from: ptr, byteCount: count) in copy()
66 memset(memory, 0, size) in initialize()
85 memory.advanced(by: currentWritingIndex), in reallocate()
87 memory.deallocate() in reallocate()
88 memory = newData in reallocate()
96 /// Aliginment of the current memory being written to the buffer
105 /// Public Pointer to the buffer object in memory. This should NOT be modified for any reason
106 public var memory: UnsafeMutableRawPointer { _storage.memory } variable
157 /// Constructor that creates a Flatbuffer from unsafe memory region without copying
158 /// - Parameter assumingMemoryBound: The unsafe memory region
159 /// - Parameter capacity: The size of the given memory region
160 public init(assumingMemoryBound memory: UnsafeMutableRawPointer, capacity: Int) {
161 _storage = Storage(memory: memory, capacity: capacity, unowned: true)
167 /// - memory: Current memory of the buffer
169 internal init(memory: UnsafeMutableRawPointer, count: Int) {
171 _storage.copy(from: memory, count: count)
175 /// Creates a copy of the existing flatbuffer, by copying it to a different memory.
177 /// - memory: Current memory of the buffer
180 internal init(memory: UnsafeMutableRawPointer, count: Int, removing removeBytes: Int) {
182 _storage.copy(from: memory, count: count)
195 /// Adds an array of type Scalar to the buffer memory
214 memcpy(_storage.memory.advanced(by: writerIndex &- size), &v, size) in push<T: NativeStruct>()
226 memcpy(_storage.memory.advanced(by: writerIndex &- len), &v, len) in push<T: Scalar>()
255 _storage.memory.advanced(by: writerIndex &- len),
264 …ect: ignores the capacity of buffer which would mean we are referring to the direct point in memory
277 _storage.memory.storeBytes(of: value, toByteOffset: index, as: T.self) in write<T>()
297 memset(_storage.memory.advanced(by: writerIndex), 0, _writerSize &- size) in pop()
307 /// Clears the current instance of the buffer, replacing it with new memory
323 return _storage.memory.advanced(by: position).load(as: T.self) in read<T>()
326 /// Reads a slice from the memory assuming a type of T
329 /// - count: count of bytes in memory
338 let start = _storage.memory.advanced(by: _index).assumingMemoryBound(to: T.self)
357 let start = _storage.memory.advanced(by: _index).assumingMemoryBound(to: UInt8.self)
368 memory: _storage.memory, in duplicate()
378 buffer located at: \(_storage.memory), with capacity of \(_storage.capacity)