これは、昨日のより広範な質問に便乗しています。問題を特定するためにヒープショットを使用してきましたが、それらはすべて私がよく知らない呼び出し元にあります。私が自分で書いたメソッドは表示されませんが、CoreGraphics は狂ったようにメモリを消費しているようです。
今週アプリを提出する準備は万端でしたが、大きな問題が発生しました。私は多くの QA とリーク検出を行っており、ヒープショット/割り当てプロファイリングでプロセスを終了していました。残念ながら、これは計画通りにはいきませんでした。このプログラム自体は「漏れている」わけではありませんが、間違いなく上昇しています。
プログラムを説明する最良の方法は、数学のフラッシュカードです (最初のアプリで、コツを学ぶので、簡単にしたかったのです)。5 つのボタン、2 つの画像ビュー、2 つの UILabels があります。私は壁に頭をぶつけて、私のデザインに問題があるのではないかと考えています (短い答え: たぶん)、それよりもメモリ クリープが心配で、ほとんど確実にアプリ ストアにアクセスできなくなります。
つまり、プロセス: ビューには、ホーム ボタン (メイン メニューに戻るため)、チェックボックス (後で問題をマークするため)、UILabel の数学の問題、および [答えを得る] ボタンが表示されます。回答を得るを押すと、2 番目の UILabel に回答が表示され、さらに 2 つのボタン (Right と Wrong) が表示され、Get Answer ボタンのタイトルが「Get Problem」に変わります。Get Problem を押すと、新しい問題で最初にリセットされます。
私はヒープショットを使用して、どれだけのメモリが占有されているかを調べてきました.1回の繰り返しを行うたびに、10〜15KBの間で失われていることがわかりました(「答えを得る」を押してから「右」または"違う")。最悪の犯罪者は「CGGlyphBitmapCreate」と呼ばれるもので、正直なところ、それが実際に何であるかについてはほとんど知りません。
その他の注意事項: 「ホーム」ボタンは、IB で作成された .png を持つカスタム ボタンです。チェックボックスの状態に応じて(.hiddenを介して)切り替える2つの.pngの上にテキストではない「マーク付き」ボタン(一方を非表示にしてからもう一方を表示、またはその逆)。
コール スタック:
0 libSystem.B.dylib calloc
1 CoreGraphics CGGlyphBitmapCreate
2 CoreGraphics CGFontCreateGlyphBitmap8
3 CoreGraphics CGFontCreateGlyphBitmap
4 CoreGraphics CGGlyphLockLockGlyphBitmaps
5 libRIP.A.dylib ripc_DrawGlyphs
6 CoreGraphics draw_glyphs
7 CoreGraphics CGContextShowGlyphsWithAdvances
8 WebCore WebCore::showGlyphsWithAdvances(WebCore::FloatPoint const&, WebCore::SimpleFontData const*, CGContext*, unsigned short const*, CGSize const*, unsigned long)
9 WebCore WebCore::Font::drawGlyphs(WebCore::GraphicsContext*, WebCore::SimpleFontData const*, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, bool) const
10 WebCore WebCore::Font::drawSimpleText(WebCore::GraphicsContext*, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) const
11 WebCore WebCore::Font::drawText(WebCore::GraphicsContext*, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) const
12 WebKit drawAtPoint(unsigned short const*, int, WebCore::FloatPoint const&, WebCore::Font const&, WebCore::GraphicsContext*, bool, WebCore::BidiStatus*, int)
13 WebKit -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:renderedStringOut:drawUnderline:]
14 WebKit -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:renderedStringOut:]
15 WebKit -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:]
16 WebKit -[NSString(WebStringDrawing) _web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:]
17 UIKit -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:]
18 UIKit -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:fontSize:lineBreakMode:baselineAdjustment:includeEmoji:]
19 UIKit -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:fontSize:lineBreakMode:baselineAdjustment:]
20 UIKit -[UILabel _drawTextInRect:baselineCalculationOnly:]
21 UIKit -[UILabel drawTextInRect:]
22 UIKit -[UILabel drawRect:]
23 UIKit -[UIView(CALayerDelegate) drawLayer:inContext:]
24 QuartzCore -[CALayer drawInContext:]
25 QuartzCore backing_callback(CGContext*, void*)
26 QuartzCore CABackingStoreUpdate_
27 QuartzCore CA::Layer::display_()
28 QuartzCore -[CALayer _display]
29 QuartzCore CA::Layer::display()
30 QuartzCore -[CALayer display]
31 QuartzCore CA::Layer::display_if_needed(CA::Transaction*)
32 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
33 QuartzCore CA::Transaction::commit()
34 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
35 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
36 CoreFoundation __CFRunLoopDoObservers
37 CoreFoundation __CFRunLoopRun
38 CoreFoundation CFRunLoopRunSpecific
39 CoreFoundation CFRunLoopRunInMode
40 GraphicsServices GSEventRunModal
41 GraphicsServices GSEventRun
42 UIKit UIApplicationMain
43 MathProb main /Users/test/MathProb/main.m:14
44 MathProb start
前もって感謝します。