开发者

Handle large .plist files with CFPropertyList

开发者 https://www.devze.com 2023-03-17 07:54 出处:网络
I\'m using CFPropertyList from https://github.com/rodneyrehm/CFPropertyList for handling content I add with PHP.

I'm using CFPropertyList from https://github.com/rodneyrehm/CFPropertyList for handling content I add with PHP.

It all worked fine, but now that all content is added my file has about 700KB which is not big but seems big enough to let Apache crash on trying to save a file.

child pid 1278 exit signal Segmentation fault

I see in CacheGrind that a lot of time in 开发者_开发知识库my application is taken by calls to CFPropertyList->import() and CFDictionary->toXML() so where could be the bottleneck there???

Am I making to many changes at once? Should I load() and save() inbetween changes more to avoid having too many changes saved at once?

Any clue?


I do not think that it's the size that makes problems but a bug in PHP. Segfaults occur only if there is a serious bug in PHP itself.

The next steps:

  • First, upgrade to the latest PHP version (5.3.6)
  • If it does not happen anymore, feel happy
  • It still happens:
    • Reproduce the issue with a PHP script no longer than 20 lines.
    • Report the issue to bugs.php.net


When you implement a searchNode() function in an document of unknown size, you should always use a "depth" parameter to avoid stepping down in the document and calling your function enormous times in a recursive loop.

Because that creates infinite loops that also cause a segfault in PHP which don't end in a fatal error or warning.

0

精彩评论

暂无评论...
验证码 换一张
取 消