@@ -156,14 +156,14 @@ void CMemoryPool::Free( const CMemoryHandle& handle )
156
156
TUsedAddressMap::const_iterator it = usedMap.find ( GetRaw ( handle ) );
157
157
const CUsedInfo& info = it->second ;
158
158
159
- if ( info.buffer != nullptr ) {
160
- CMemoryBufferPool* const pool = info.buffer ->OwnerPool ;
161
- pool->Free ( info.buffer );
159
+ if ( info.HasPoolBuffer () ) {
160
+ CMemoryBufferPool* const pool = info.Buffer () ->OwnerPool ;
161
+ pool->Free ( info.Buffer () );
162
162
freeMemorySize += pool->BufferSize ;
163
163
} else {
164
164
// Large buffer, don't use the pool
165
- freeMemory ( info.size , handle );
166
- freeMemorySize += info.size ;
165
+ freeMemory ( info.Size () , handle );
166
+ freeMemorySize += info.Size () ;
167
167
}
168
168
usedMap.erase ( it );
169
169
}
@@ -189,9 +189,9 @@ void CMemoryPool::TransferHandleToThisThread( const CMemoryHandle& handle, size_
189
189
TUsedAddressMap::iterator usedMapIt = usedMap.find ( GetRaw ( handle ) );
190
190
CUsedInfo& info = usedMapIt->second ;
191
191
192
- if ( info.buffer != nullptr ) {
192
+ if ( info.HasPoolBuffer () ) {
193
193
// Find the buffer pool to steal from
194
- CMemoryBufferPool* otherThreadBufferPool = info.buffer ->OwnerPool ;
194
+ CMemoryBufferPool* otherThreadBufferPool = info.Buffer () ->OwnerPool ;
195
195
ASSERT_EXPR ( size <= otherThreadBufferPool->BufferSize );
196
196
size = otherThreadBufferPool->BufferSize ; // set actual allocated size
197
197
@@ -200,7 +200,7 @@ void CMemoryPool::TransferHandleToThisThread( const CMemoryHandle& handle, size_
200
200
if ( !thisThreadData.Enabled ) {
201
201
// Transfer the handle from that thread's pool just to heap, so
202
202
// it wouldn't be cleaned-up for that thread after mathEngine.CleanUp().
203
- delete info.buffer ;
203
+ delete info.Buffer () ;
204
204
info = CUsedInfo ( size );
205
205
} else {
206
206
// Find the buffer in this thread's pool to append it to
@@ -212,11 +212,11 @@ void CMemoryPool::TransferHandleToThisThread( const CMemoryHandle& handle, size_
212
212
}
213
213
}
214
214
// Transfer the handle from other thread-owner to this thread-owner
215
- info.buffer ->OwnerPool = thisThreadBufferPool;
215
+ info.Buffer () ->OwnerPool = thisThreadBufferPool;
216
216
}
217
217
} else { // Large buffers don't use the pools
218
218
const size_t validSize = *std::lower_bound ( std::begin ( BufferSizes ), std::end ( BufferSizes ), size );
219
- ASSERT_EXPR ( size == info.size || validSize == info.size );
219
+ ASSERT_EXPR ( size == info.Size () || validSize == info.Size () );
220
220
// No need to transfer, because
221
221
// it wouldn't be cleaned-up for that thread after mathEngine.CleanUp().
222
222
}
0 commit comments