我只是想弄清楚为什么下面的代码会泄漏内存,并且我有一种有趣的感觉,我没有正确释放数组内存。这是一个更广泛的 Objective-C 应用程序中的 C 函数,我不是 C 语言的本地人...我尝试过在数组上使用 free() ,但有一种感觉这不是全部故事...
有人可以看一下我在这里缺少什么吗?谢谢!
CFIndex theNumberOfSettings = 3;
CTParagraphStyleSetting theSettings[3] =
{
{kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment},
{kCTParagraphStyleSpecifierLineSpacing, sizeof(lineSpacing), &lineSpacing},
{kCTParagraphStyleSpecifierHeadIndent, sizeof(headIndent), &headIndent}
};
CTParagraphStyleRef theParagraphRef = CTParagraphStyleCreate(theSettings, theNumberOfSettings);
CFAttributedStringSetAttribute(attrString, CFRangeMake(0, CFAttributedStringGetLength(attrString)-1), kCTParagraphStyleAttributeName, theParagraphRef);
CFRelease(theParagraphRef);
free(theSettings);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)