mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 15:02:42 +01:00
Allow disabling some GC debug checks
This commit is contained in:
parent
a38a7b495c
commit
f7f73cf5ae
2 changed files with 11 additions and 9 deletions
|
|
@ -295,8 +295,10 @@ std::pair<Size, Size> GC::Arena::freeUnmarked()
|
|||
obj->unmark();
|
||||
} else {
|
||||
//debug("FREE OBJECT %x %d %d", obj, obj->type, objSize);
|
||||
#if GC_DEBUG
|
||||
for (Size i = 0; i < objSize; ++i)
|
||||
((Word *) obj)[i] = 0xdeadc0dedeadbeefULL;
|
||||
#endif
|
||||
objectsFreed += 1;
|
||||
wordsFreed += objSize;
|
||||
if (curFree) {
|
||||
|
|
@ -333,14 +335,6 @@ bool GC::isObject(void * p)
|
|||
return false;
|
||||
}
|
||||
|
||||
void GC::assertObject(void * p)
|
||||
{
|
||||
if (!isObject(p)) {
|
||||
printError("object %p is not an object", p);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
GC::ArenaList::ArenaList()
|
||||
{
|
||||
static Size initialHeapSize = std::stol(getEnv("GC_INITIAL_HEAP_SIZE", "1000000")) / WORD_SIZE;
|
||||
|
|
|
|||
|
|
@ -277,7 +277,15 @@ public:
|
|||
|
||||
bool isObject(void * p);
|
||||
|
||||
void assertObject(void * p);
|
||||
void assertObject(void * p)
|
||||
{
|
||||
#if GC_DEBUG
|
||||
if (!isObject(p)) {
|
||||
printError("object %p is not an object", p);
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
extern GC gc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue