MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / cleanup

Method cleanup

src/jrd/Monitoring.cpp:339–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337
338
339void MonitoringData::cleanup(AttNumber att_id)
340{
341 // Remove information about the given session
342
343 for (ULONG offset = HEADER_SIZE; offset < m_sharedMemory->getHeader()->used;)
344 {
345 const auto ptr = (UCHAR*) m_sharedMemory->getHeader() + offset;
346 const auto element = (Element*) ptr;
347 const ULONG length = element->getBlockLength();
348
349 if (element->attId == att_id)
350 {
351 if (offset + length < m_sharedMemory->getHeader()->used)
352 {
353 memmove(ptr, ptr + length, m_sharedMemory->getHeader()->used - offset - length);
354 m_sharedMemory->getHeader()->used -= length;
355 }
356 else
357 {
358 m_sharedMemory->getHeader()->used = offset;
359 }
360
361 break;
362 }
363
364 offset += length;
365 }
366}
367
368
369void MonitoringData::ensureSpace(ULONG length)

Callers 3

MonitoringSnapshotMethod · 0.45
dumpAttachmentMethod · 0.45
cleanupAttachmentMethod · 0.45

Calls 2

getBlockLengthMethod · 0.80
getHeaderMethod · 0.45

Tested by

no test coverage detected