MCPcopy Create free account
hub / github.com/KDE/kdevelop / initialize

Method initialize

kdevplatform/serialization/itemrepository.h:224–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222 }
223
224 void initialize(int monsterBucketExtent, std::unique_ptr<short unsigned int[]> nextBucketHashToRestore = {})
225 {
226 if (!m_data) {
227 m_monsterBucketExtent = monsterBucketExtent;
228 m_available = ItemRepositoryBucketSize;
229 m_data = new char[dataSize()];
230#ifndef QT_NO_DEBUG
231 std::fill_n(m_data, dataSize(), 0);
232#endif
233 //The bigger we make the map, the lower the probability of a clash(and thus bad performance). However it increases memory usage.
234 // NOTE: the `()` at the end of `new int[...]()` ensures the data is zero-initialized, see e.g.:
235 // https://stackoverflow.com/questions/7546620/operator-new-initializes-memory-to-zero
236 m_objectMap = new short unsigned int[ObjectMapSize]();
237
238 if (nextBucketHashToRestore) {
239 m_nextBucketHash = nextBucketHashToRestore.release();
240 } else {
241 m_nextBucketHash = new short unsigned int[NextBucketHashSize]();
242 }
243
244 m_changed = true;
245 m_dirty = false;
246 m_lastUsed = 0;
247 }
248 }
249
250 void initializeFromMap(char* fileMapData)
251 {

Callers 5

convertMonsterBucketMethod · 0.45
initializeBucketMethod · 0.45
allocateNextBucketsMethod · 0.45
initCoreMethod · 0.45
initCoreMethod · 0.45

Calls 1

releaseMethod · 0.80

Tested by 2

initCoreMethod · 0.36
initCoreMethod · 0.36