Forum Discussion
jobrandh
9 years agoHonored Guest
Bug Report: Memory leak in Win32_DirectXAppUtil.h
Hi, not sure where the right place to put this is, but I noticed that there's a memory leak in one of the headers included in all the 0.8 SDK Samples. See the following code (pix isn't been free'd):
Just thought I'd let you know (is there a better place for this kind of thing?).
Win32_DirectXAppUtil.h ln 438
void AutoFillTexture(int autoFillData)
{
DWORD * pix = (DWORD *)malloc(sizeof(DWORD) * SizeW * SizeH);
for (int j = 0; j < SizeH; j++)
for (int i = 0; i < SizeW; i++)
{
DWORD * curr = &pix[j*SizeW + i];
switch (autoFillData)
{
case(AUTO_WALL) : *curr = (((j / 4 & 15) == 0) || (((i / 4 & 15) == 0) && ((((i / 4 & 31) == 0) ^ ((j / 4 >> 4) & 1)) == 0))) ?
0xff3c3c3c : 0xffb4b4b4; break;
case(AUTO_FLOOR) : *curr = (((i >> 7) ^ (j >> 7)) & 1) ? 0xffb4b4b4 : 0xff505050; break;
case(AUTO_CEILING) : *curr = (i / 4 == 0 || j / 4 == 0) ? 0xff505050 : 0xffb4b4b4; break;
case(AUTO_WHITE) : *curr = 0xffffffff; break;
case(AUTO_GRADE_256) : *curr = 0xff000000 + i * 0x010101; break;
case(AUTO_GRID) : *curr = (i<4) || (i>(SizeW - 5)) || (j<4) || (j>(SizeH - 5)) ? 0xffffffff : 0xff000000; break;
default: *curr = 0xffffffff; break;
}
///ConvertToSRGB(curr); //Require format for SDK - I've been recommended to remove for now.
}
FillTexture(pix);
free(pix); // This isnt here in the SDK, which causes "pix" to be leaked.
}
Just thought I'd let you know (is there a better place for this kind of thing?).
2 Replies
- galopinHeroic ExplorerNever raw pointer !
auto pix = std::make_unique<dword[]>(w*h);
- cyberealityGrand ChampionLet me see if anyone knows about this.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device