| 281 | //========================================================================== |
| 282 | |
| 283 | static size_t DestroyObjects(size_t count) |
| 284 | { |
| 285 | DObject *curr; |
| 286 | size_t bytes_destroyed = 0; |
| 287 | |
| 288 | while ((curr = ToDestroy) != nullptr && count-- > 0) |
| 289 | { |
| 290 | // Note that we cannot assume here that the object has not yet been destroyed. |
| 291 | // If destruction happens as the result of another object's destruction we may |
| 292 | // get entries here that have been destroyed already if that owning object was |
| 293 | // first in the list. |
| 294 | if (!(curr->ObjectFlags & OF_EuthanizeMe)) |
| 295 | { |
| 296 | bytes_destroyed += curr->GetClass()->Size + GCDESTROYCOST; |
| 297 | ToDestroy = curr->GCNext; |
| 298 | curr->GCNext = nullptr; |
| 299 | curr->Destroy(); |
| 300 | } |
| 301 | else |
| 302 | { |
| 303 | ToDestroy = curr->GCNext; |
| 304 | curr->GCNext = nullptr; |
| 305 | } |
| 306 | } |
| 307 | return bytes_destroyed; |
| 308 | } |
| 309 | |
| 310 | //========================================================================== |
| 311 | // |
no test coverage detected