iOS library to help detecting retain cycles in runtime.
by facebookObjective-C++
Last 12 weeks · 3 commits
4 of 6 standards met
What This fixes struct parsing when a struct contains a union, and hardens the struct-offset scan against type encodings cannot handle. 1. Union parsing () - fixes #21 ObjC runtime type encodings represent a union as , or for anonymous unions. The parser did not recognize as a grouping character: it fell through to the literal branch and stopped at the first quoted member name inside the union. For a union with named members such as , the parser previously produced: …treating overlapping union members as sequential struct fields and leaving a malformed encoding. Every subsequent field's offset inside the struct was then wrong, so an object reference stored after the union was located at a garbage index (read of the wrong memory during cycle detection). The fix adds and consumes the whole union as one opaque , keeping the offsets of the types that follow it correct. 2. Layout scan hardening () - related to #126 does not throw on encodings it cannot size (bitfields , C++ types, …): it logs the "unsupported type encoding spec" warning and returns . The code ignored the return value and then computed / from zero or garbage values. The scan now checks the return value and bails out (same intent as the existing branch) instead of producing misaligned references. Tests Added to : literal encoding regression test asserting the exact parsed types. real ivar encoding with a named union. real ivar encoding with an anonymous union. Verified with a standalone C++ build of the parser (ObjC bits mechanically stubbed) that runs the new union cases plus all pre-existing parser cases (primitives, objects, nested structs, bitfields, type paths) with no regressions.
Fix a bug preventing object references from being detected when the reference is from a property inherited from a parent class. Example: The logic here would receive a value for if the object's did not have a direct child for the associated . Note: I have tested this manually but the existing project is not in a buildable state in order to be able to write a test.
Repository: facebook/FBRetainCycleDetector. Description: iOS library to help detecting retain cycles in runtime. Stars: 4232, Forks: 601. Primary language: Objective-C++. Languages: Objective-C++ (39.6%), Objective-C (35.7%), Swift (20.2%), C (3.6%), Ruby (0.6%). Latest release: 0.1.4 (8y ago). Open PRs: 7, open issues: 36. Last activity: 5d ago. Community health: 75%. Top contributors: megCanicalKb, tditchek, twhitt14, rmaz, rs17b, amonshiz, arj-fb, youngd007, chowarfb, ingridwang and others.