Config variables not working

There is probably something very simple that I’m missing, but for the life of me I can’t see it. It seems that Panda isn’t acknowledging any of the config variables that I’ve set, regardless of how I’ve set them. I’m not quite sure when this started, possibly when I moved from 1.9.3 to 1.9.4, or maybe when I moved from the 32-bit version to the 64-bit version. I override a lot of the settings manually, such as screen resolution, so this just slipped under my radar.

I have a few configuration options that I’ve set, such as settings assert-abort to 1. I’ve recently been trying to troubleshoot a memory leak, so I tried setting track-memory-usage. To make sure that config.prc was being interpreted correctly, I used the following code to make sure that was being set properly:

ConfigVariableBool bTrackMemoryUsage("track-memory-usage");
if (bTrackMemoryUsage.get_value() == true)
{
	printf("track-memory-usage is enabled\n");
}
else
{
	printf("track-memory-usage is disabled\n");
}

In the debug window, I see “track-memory-usage is enabled” so I know that the config variable is being set properly. Then, when I run this:

if (MemoryUsage::is_tracking() == false)
{
	printf("Memory tracking is disabled\n");
}
else
{
	printf("Memory tracking is enabled\n");
}

I see “Memory tracking is disabled.”

I originally thought there was some particular to the MemoryUsage class that I didn’t understand, but then I found that assert-abort wasn’t being acknowledged either. I’ve tried setting these through config.prc, and manually using ConfigVariableBool. If anyone has any advice on how to proceed, I would very much appreciate the help.

Thanks!

OK, figured it out. It looks like track-memory-usage needs to be set in the initial PRC file load so that it can get pulled into MemoryUsage’s static constructor. I was calling load_prc_file from a different PRC file location, and at that point it was too late to enable track-memory-usage. So, problem solved! Hopefully this post can help someone else down the line.