Memory leak with custom style
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- cpp, objective-c
- 領域
- devtools
調査の方向性
Blender の .clang-format スタイルと 18 行の C++ 例を使って XcodeClangFormat プロジェクトの失敗を再現し、その後、trace に記載されている Extension パスと ClangFormatCommand エントリポイントを調査します。ファイルを 2 回目にフォーマットしても失敗せず、Extension が約 500 MB を蓄積せず、XPC 接続が引き続き使用可能であれば完了です。
索引モデルが issue の本文から書いたものです。
説明
- Setup the Xcode project for XcodeClangFormat for debugging.
- Build the app and set the style to https://github.com/blender/blender/blob/master/.clang-format
- Run Extension this time and Xcode launches. Wait for the debugger to attach to the extension.
- New Xcode command line tool project of C++ language.
- In the C++ file, select all, paste the code given in the summary. [1] it's total 18 lines.
- Editor > clang format > format entire file. It will format it correctly.
- Select all again, paste the code still in your clipboard.
- Editor > clang format > format entire file. It will fail & the original Xcode instance shows memory increase that settles around 500 MB. The trace appears in the console [2] & UI looks like this [3].
[1] Code to copy
//
// main.cpp
// clang-format-test
//
// Copyright © 2020 ak. All rights reserved.
//
#include <iostream>
#include "main.hh"
int main(int argc, const char *argv[])
{
// Long comment that must be broken down in multiple lines.
// insert code here... insert code here... insert code here... insert code here... insert code here... insert code here...
std::cout << "Hello, World!\n";
return 0;
}
[2] Trace in console
2020-08-03 00:39:49.395275+0530 clang-format[6941:258937] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x60b000012c00> (Domain: XcodeClangFormat, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
2020-08-03 00:40:00.626852+0530 clang-format[6941:258937] [general] <NSXPCConnection: 0x60d000017bb0> connection from pid 6924: Warning: Exception caught during invocation of received message, dropping incoming message and invalidating the connection.
Exception: *** -[__NSArrayM objectAtIndex:]: index 18 beyond bounds [0 .. 17]
*** -[__NSArrayM objectAtIndex:]: index 18 beyond bounds [0 .. 17]
(
0 CoreFoundation 0x00007fff46876a7d __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff70f4ba17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff468b5a74 -[CFPrefsConfigurationFileSource initWithConfigurationPropertyList:containingPreferences:] + 0
3 CoreFoundation 0x00007fff467b21de -[CFPrefsSearchListSource addNamedVolatileSourceForIdentifier:] + 0
4 clang-format 0x0000000105a5ce7b -[ClangFormatCommand performCommandWithInvocation:completionHandler:] + 9099
5 XcodeKit 0x000000010ae192f4 -[_XCSourceEditorService performCommandInvocation:commandIdentifier:request:reply:] + 494
6 Foundation 0x00007fff48a8da0b __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S4__ + 12
7 Foundation 0x00007fff48a3298f -[NSXPCConnection _decodeAndInvokeMessageWithEvent:flags:] + 2499
8 Foundation 0x00007fff48a31d63 message_handler + 215
9 libxpc.dylib 0x00007fff7294df08 _xpc_connection_call_event_handler + 56
10 libxpc.dylib 0x00007fff7294be9e _xpc_connection_mach_event + 933
11 libdispatch.dylib 0x00007fff726cc6dd _dispatch_client_callout4 + 9
12 libdispatch.dylib 0x00007fff726e10d6 _dispatch_mach_msg_invoke + 436
13 libdispatch.dylib 0x00007fff726d2792 _dispatch_lane_serial_drain + 268
14 libdispatch.dylib 0x00007fff726e1c19 _dispatch_mach_invoke + 481
15 libdispatch.dylib 0x00007fff726d2792 _dispatch_lane_serial_drain + 268
16 libdispatch.dylib 0x00007fff726d33c6 _dispatch_lane_invoke + 433
17 libdispatch.dylib 0x00007fff726db6ed _dispatch_workloop_worker_thread + 598
18 libsystem_pthread.dylib 0x00007fff7290c611 _pthread_wqthread + 421
19 libsystem_pthread.dylib 0x00007fff7290c3fd start_wqthread + 13
)
[3] UI looks like

- 主要言語
- Objective-C++
- スター
- 807
- フォーク
- 102
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mapbox/XcodeClangFormat のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 20/100
mapbox/XcodeClangFormat#61 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
mapbox/XcodeClangFormat#60 ·
-
OC怎么自定义代码规范规则? オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
mapbox/XcodeClangFormat#58 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
mapbox/XcodeClangFormat#57 ·
-
Not work on Xcode 12 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
mapbox/XcodeClangFormat#53 · コメント 34 件 · リアクション 1 件 ·
mapbox/XcodeClangFormat の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
palladius/rails8-app-on-gcp#145 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#156 ·
-
area:workflow bug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fil-donadoni/tolaria#4409 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotenvx/dotenv-vscode#139 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Fission-AI/OpenSpec#1960 ·