开发者

Memory leak with Texture2D

I'm using Apple's Texture2D class from their CrashLanding example to draw dynamic text on the screen.

Here's my method:

    - (void) drawText:(NSString*)textToDraw atX:(float)X andY:(float)Y {

    glColor4f(0, 0, 0, 1.0);

    Texture2D* _text = [[Texture2D alloc] initWithString:textToDraw dimensions:CGSizeMake(512, 512) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:11];

    glBindTexture(GL_TEXTURE_2D, [_text name]);

    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    [_text drawAtPoint:CGPointMake(.5,.5)];
    [_text release];       

    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_BLEND);    
}

I knew since this method loops, allocating it would cause a leak, so I hoped releasing it wouldn't case an issue. However, after around 10 seconds, despite releasing the Texture, the game crashes. I can't allocate the texture in the init method because that would limit the text to be static.

I also tried modifying the Texture2D class to allow dynamic text, but couldn't succeed.

Update: Crash report from the iPhone simulator

Process:         Game [31087]
Path:            /Users/robertfratto/Library/Application Support/iPhone Simulator/4.2/Applications/3AF59DDA-79AC-412D-A968-C80DABEC7B19/Game.app/Game
Identifier:      Game
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  ??? [31088]

Date/Time:       2011-01-10 01:06:45.059 -0500
OS Version:      Mac OS X 10.6.6 (10J567)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  4

Application Specific Information:
iPhone Simulator 23开发者_StackOverflow中文版5, iPhone OS 4.2 (iPhone (Retina)/8C134)

Thread 0:  Dispatch queue: com.apple.main-thread
0   dyld                            0x8fe12fae ImageLoaderMachOClassic::prefetchLINKEDIT(ImageLoader::LinkContext const&) + 124
1   dyld                            0x8fe1316a ImageLoaderMachOClassic::rebase(ImageLoader::LinkContext const&) + 82
2   dyld                            0x8fe104d4 ImageLoaderMachO::doRebase(ImageLoader::LinkContext const&) + 286
3   dyld                            0x8fe0cdb1 ImageLoader::recursiveRebase(ImageLoader::LinkContext const&) + 91
4   dyld                            0x8fe0de70 ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, ImageLoader::RPathChain const&) + 158
5   dyld                            0x8fe056af dyld::link(ImageLoader*, bool, ImageLoader::RPathChain const&) + 137
6   dyld                            0x8fe0b242 dlopen + 471
7   libSystem.B.dylib               0x95fce8a8 dlopen + 66
8   com.apple.CoreGraphics          0x00ae3e71 load_function + 619
9   com.apple.CoreGraphics          0x00ae4016 CGLibraryLoadFunction + 193
10  com.apple.CoreGraphics          0x00b4501e load_library + 38
11  com.apple.CoreGraphics          0x00b450f5 load_vtable + 162
12  libSystem.B.dylib               0x95fe6900 pthread_once + 82
13  com.apple.CoreGraphics          0x00b44fec CGFontGetVTable + 37
14  com.apple.CoreGraphics          0x00ada052 CGFontFinderGetDefault + 28
15  com.apple.CoreGraphics          0x00b11c99 CGFontCreateWithFontName + 63
16  com.apple.CoreGraphics          0x00b11de6 CGFontCreateWithName + 57
17  GraphicsServices                0x011b9d3c GSFontCreateWithName + 494
18  UIKit                           0x0019fa7b UINewFont + 100
19  UIKit                           0x0019faa7 +[UIFont systemFontOfSize:traits:] + 33
20  UIKit                           0x0019ee00 +[UIFont systemFontOfSize:] + 49
21  UIKit                           0x0015a537 +[UILabel defaultFont] + 45
22  UIKit                           0x0015ccc3 -[UILabel _commonInit] + 96
23  UIKit                           0x0015ab0b -[UILabel initWithFrame:] + 98
24  Game                            0x00002921 -[EAGLView initWithCoder:] + 264 (EAGLView.m:37)
25  UIKit                           0x00232265 -[UIClassSwapper initWithCoder:] + 237
26  Foundation                      0x00790c7c _decodeObjectBinary + 3296
27  Foundation                      0x00791a4d -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1354
28  Foundation                      0x0079207c -[NSArray(NSArray) initWithCoder:] + 596
29  Foundation                      0x00790c7c _decodeObjectBinary + 3296
30  Foundation                      0x0078fde9 _decodeObject + 224
31  UIKit                           0x00072c5f -[UIView initWithCoder:] + 642
32  UIKit                           0x0005f709 -[UIWindow initWithCoder:] + 89
33  Foundation                      0x00790c7c _decodeObjectBinary + 3296
34  Foundation                      0x0078fde9 _decodeObject + 224
35  UIKit                           0x00231f43 -[UIRuntimeConnection initWithCoder:] + 212
36  Foundation                      0x00790c7c _decodeObjectBinary + 3296
37  Foundation                      0x00791a4d -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1354
38  Foundation                      0x0079207c -[NSArray(NSArray) initWithCoder:] + 596
39  Foundation                      0x00790c7c _decodeObjectBinary + 3296
40  Foundation                      0x0078fde9 _decodeObject + 224
41  UIKit                           0x00231200 -[UINib instantiateWithOwner:options:] + 804
42  UIKit                           0x00233081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
43  UIKit                           0x0003d943 -[UIApplication _loadMainNibFile] + 172
44  UIKit                           0x0003e4ca -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
45  UIKit                           0x00048db2 -[UIApplication handleEvent:withNewEvent:] + 1533
46  UIKit                           0x00041202 -[UIApplication sendEvent:] + 71
47  UIKit                           0x00046732 _UIApplicationHandleEvent + 7576
48  GraphicsServices                0x011bca36 PurpleEventCallback + 1550
49  CoreFoundation                  0x00f29064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
50  CoreFoundation                  0x00e896f7 __CFRunLoopDoSource1 + 215
51  CoreFoundation                  0x00e86983 __CFRunLoopRun + 979
52  CoreFoundation                  0x00e86240 CFRunLoopRunSpecific + 208
53  CoreFoundation                  0x00e86161 CFRunLoopRunInMode + 97
54  UIKit                           0x0003dfa8 -[UIApplication _run] + 636
55  UIKit                           0x0004a42e UIApplicationMain + 1160
56  Game                            0x00002510 main + 102 (main.m:13)
57  Game                            0x000024a1 start + 53

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib               0x95fee982 kevent + 10
1   libSystem.B.dylib               0x95fef09c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib               0x95fee559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib               0x95fee2fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib               0x95fedd81 _pthread_wqthread + 390
5   libSystem.B.dylib               0x95fedbc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib               0x95feda12 __workq_kernreturn + 10
1   libSystem.B.dylib               0x95fedfa8 _pthread_wqthread + 941
2   libSystem.B.dylib               0x95fedbc6 start_wqthread + 30

Thread 3:  WebThread
0   libSystem.B.dylib               0x95fc80fa mach_msg_trap + 10
1   libSystem.B.dylib               0x95fc8867 mach_msg + 68
2   CoreFoundation                  0x00f294a6 __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x00e86874 __CFRunLoopRun + 708
4   CoreFoundation                  0x00e86240 CFRunLoopRunSpecific + 208
5   CoreFoundation                  0x00e86161 CFRunLoopRunInMode + 97
6   WebCore                         0x01e4f423 RunWebThread(void*) + 499
7   libSystem.B.dylib               0x95ff585d _pthread_start + 345
8   libSystem.B.dylib               0x95ff56e2 thread_start + 34

Thread 4 Crashed:

Thread 4 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x00000000  ecx: 0x00000000  edx: 0x00000000
  edi: 0x00000000  esi: 0x00000000  ebp: 0x00000000  esp: 0x00000000
   ss: 0x0000001f  efl: 0x00010202  eip: 0x00000000   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x0000001f   gs: 0x0000001f
  cr2: 0x00000000

Binary Images:
    0x1000 -    0x24ffb +Game ??? (???) <4B8B9539-E32C-30D3-9FE8-61F1E31A7A96> /Users/robertfratto/Library/Application Support/iPhone Simulator/4.2/Applications/3AF59DDA-79AC-412D-A968-C80DABEC7B19/Game.app/Game
   0x2f000 -   0x53bff3 +UIKit 1400.0.0 (compatibility 1.0.0) <EE783C53-A647-D7F8-62CF-FB3F7DD16C54> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/UIKit.framework/UIKit
  0x780000 -   0x941fe7 +Foundation 751.49.0 (compatibility 300.0.0) <DB9A4461-C768-9B7B-E463-4568E3FAA179> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/Foundation.framework/Foundation
  0xa1e000 -   0xc51ff7  com.apple.CoreGraphics 1.600.0 (???) <78926D2F-9A6C-8B48-BD99-72B3373872BD> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
  0xcba000 -   0xdacfef +QuartzCore 1.7.0 (compatibility 1.2.0) <FCA6F109-11B7-B38B-4EBF-D5C2CA9D5CE7> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/QuartzCore.framework/QuartzCore
  0xe17000 -   0xe28ff7 +OpenGLES ??? (???) <EC9C05E6-BC78-B1B0-2044-7189D39A06FE> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/OpenGLES.framework/OpenGLES
  0xe31000 -   0xe42ff7 +libSystem.dylib 125.0.0 (compatibility 1.0.0) <76CE85FC-AAC8-DE1C-B533-ABCEF8783B8F> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libSystem.dylib
  0xe55000 -   0xfa4fef +CoreFoundation 550.52.0 (compatibility 150.0.0) <CDA305C1-38E1-514F-0EFB-4B6A58E296D5> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 0x1096000 -  0x1163fe3 +libobjc.A.dylib 227.0.0 (compatibility 1.0.0) <FEB8BB90-29E8-F87A-EA47-9395667DA191> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libobjc.A.dylib
 0x11b5000 -  0x11c5fe3 +GraphicsServices 14.0.0 (compatibility 1.0.0) <BA0B832B-2252-0434-BFD7-99415BEDF76B> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
 0x11d6000 -  0x1373ff3 +JavaScriptCore 533.17.9 (compatibility 1.0.0) <8B97277F-F677-F9B0-F82F-5E1E608EFA84> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
 0x13c6000 -  0x1410ffb +SystemConfiguration 379.0.0 (compatibility 1.0.0) <5A1E5868-7B70-7184-F4F6-B0FC574E49A0> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
 0x142f000 -  0x1510ffb +ImageIO ??? (???) <6FAE198A-EAC4-9FBF-A922-1DF8200FD269> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/ImageIO.framework/ImageIO
 0x153a000 -  0x1586ff3 +AddressBook 30.0.0 (compatibility 1.0.0) <A011434A-1249-3B7D-97EF-08F0AA0EFBB3> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/AddressBook.framework/AddressBook
 0x15b0000 -  0x1747fe7 +AudioToolbox 296.0.0 (compatibility 1.0.0) <C35F6411-41EB-92EC-F0E1-E3328746061D> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
 0x179b000 -  0x17aefff +SpringBoardServices ??? (???) <AE58FA0A-B824-CF60-3F40-4CEBBFC2F236> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
 0x17ba000 -  0x17fdffb +AppSupport 29.0.0 (compatibility 1.0.0) <1B38F0B4-36BB-5BEB-917A-A5CFBFCEDADA> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
 0x1822000 -  0x1890fe3 +CoreText ??? (???) <EE0D05CA-772A-9D07-7931-06B948B209D5> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreText.framework/CoreText
 0x18bd000 -  0x1a63fe7 +libicucore.A.dylib 45.0.0 (compatibility 1.0.0) <05674AB8-3A5A-0D89-79F8-EA0817A32D38> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libicucore.A.dylib
 0x1acf000 -  0x1b11feb +MobileCoreServices 20.0.0 (compatibility 1.0.0) <0F2407B2-C515-C6AC-B72B-0BA21568B152> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
 0x1b2b000 -  0x1bacffb +libsqlite3.dylib 9.6.0 (compatibility 9.0.0) <BCEA48F2-1BF3-BD41-F3D8-D905806BFA57> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libsqlite3.dylib
 0x1bbe000 -  0x1c9fff7 +WebKit 533.17.9 (compatibility 1.0.0) <C2BA78C7-45EC-54AA-E020-D7FD6ECE06F9> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/WebKit.framework/WebKit
 0x1d17000 -  0x2afeffb +WebCore 533.17.9 (compatibility 1.0.0) <D9EEBA8C-F9D4-FAF4-E0BF-58CE7DAAFB96> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/WebCore.framework/WebCore
 0x2ffa000 -  0x30adfe3 +ProofReader 101.0.0 (compatibility 1.0.0) <196C8CFD-C6BA-A5DE-5785-7F6042DC6425> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/ProofReader.framework/ProofReader
 0x30c4000 -  0x320aff7 +CFNetwork 485.12.7 (compatibility 1.0.0) <FCD41C21-04EF-CDBB-84AC-9017DC3BF552> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CFNetwork.framework/CFNetwork
 0x3288000 -  0x328bff7 +libAccessibility.dylib ??? (???) <BFB0EA39-9E6F-026C-0C23-66A12AB3D336> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libAccessibility.dylib
 0x3293000 -  0x32c1ff7 +PrintKit 66.0.0 (compatibility 1.0.0) <F171F166-8B5C-FBC7-497E-9DCDEB158348> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/PrintKit.framework/PrintKit
 0x32d5000 -  0x3339feb +Security ??? (???) <1D093A0E-0E15-231C-F11D-0645230EF7A1> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/Security.framework/Security
 0x3361000 -  0x3460fe7 +libxml2.2.dylib 10.3.0 (compatibility 10.0.0) <08B31BB7-E603-0C9A-1D7D-17637EFEDA54> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libxml2.2.dylib
 0x3485000 -  0x3493ff7 +libz.1.dylib 1.2.3 (compatibility 1.0.0) <F91C1567-31B2-CEFD-2D61-1B76C9F89E6A> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libz.1.dylib
 0x3498000 -  0x349bff7 +IOKit 275.0.0 (compatibility 1.0.0) <E244134E-FFD4-D9C4-BF8E-E1235C0C17B7> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/IOKit.framework/IOKit
 0x34a3000 -  0x34b9ff7 +libSystem.override.dylib ??? (???) <477EA8CC-61D1-D179-A7B6-2BB7C377600B> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/system/libSystem.override.dylib
 0x34c4000 -  0x3545fe3 +CoreTelephony 383.8.3 (compatibility 1.0.0) <7BEDF930-9CA4-E6A2-BBCE-C6E7A14DEE69> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
 0x3588000 -  0x3589fff +DataMigration ??? (???) <87E44081-5DCB-6597-6865-90780FEB8597> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/DataMigration.framework/DataMigration
 0x358e000 -  0x3591ff7 +MobileInstallation ??? (???) <DFD90490-F485-6945-1ABE-F4D6C7A94574> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
 0x3597000 -  0x35cbfff +Bom 157.0.0 (compatibility 2.0.0) <7FE61FCF-0E89-0744-F24C-2D1F6C1EAE89> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/Bom.framework/Bom
 0x35d8000 -  0x35e5fe7 +libbz2.1.0.dylib 1.0.5 (compatibility 1.0.0) <BD82EE16-8FB3-A7F5-4CC0-EDE15AC18507> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libbz2.1.0.dylib
 0x35ea000 -  0x35f5ff7 +AggregateDictionary ??? (???) <37904D52-6186-14BB-560B-D8B21316BB52> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary
 0x3600000 -  0x3674ff7 +CoreAudio ??? (???) <0669925D-3993-07DC-9E76-369C1709553E> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreAudio.framework/CoreAudio
 0x36a9000 -  0x3b19ff3 +libBLAS.dylib ??? (???) <3EE46AD9-7807-F326-E0AF-BAEF5939654B> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
 0x3b3f000 -  0x3f81fe7 +libLAPACK.dylib ??? (???) <F66279A8-EE9C-5723-C3A0-E507ED462F8F> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
 0x3fad000 -  0x3fb9ff7 +CoreVideo 1.6.1 (compatibility 1.2.0) <966447F0-FB24-EC43-006E-CD32F1924481> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreVideo.framework/CoreVideo
 0x3fc6000 -  0x3fcbff3 +libGFXShared.dylib ??? (???) <0694A0A1-F539-2856-C2BA-61D323D56DEF> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
 0x3fd1000 -  0x400cff7 +libGLImage.dylib ??? (???) <9318562A-FDB5-0722-FC9C-BA0057BD3F53> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
 0x4015000 -  0x4120ff7 +libGLProgrammability.dylib ??? (???) <F7AC6198-8A35-5DC9-2BDD-AD03BEC21EF5> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
 0x4140000 -  0x4147fff +libCoreVMClient.dylib ??? (???) <785DDEAB-CB21-E1A6-35C2-A7A3E02E48B2> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib
 0x414f000 -  0x4935f4f +libLLVMContainer.dylib ??? (???) <067A9A4D-1B73-B338-BD26-54D28AFCC04F> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/OpenGLES.framework/libLLVMContainer.dylib
 0x4a8c000 -  0x4a91ff3 +AssetsLibraryServices ??? (???) <5BC721E0-FB4E-B81B-4FED-DF7189AD8BA0> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices
 0x4a97000 -  0x4a97ff7 +libresolv.dylib 41.0.0 (compatibility 1.0.0) <78A807DB-B13E-9550-9C2E-8DA1DCBFEE8A> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libresolv.dylib
 0x4f20000 -  0x4f6dfe7 +libCGFreetype.A.dylib 600.0.0 (compatibility 64.0.0) <2DFF120B-1542-ED85-07DC-EE7394592B76> /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x8fe00000 - 0x8fe4162b  dyld 132.1 (???) <28F0312C-0678-159E-34E2-9A4E3DEADB20> /usr/lib/dyld
0x9209f000 - 0x920bffe7  libresolv.9.dylib 41.0.0 (compatibility 1.0.0) <751955F3-21FB-A03A-4E92-1F3D4EFB8C5B> /usr/lib/libresolv.9.dylib
0x92d05000 - 0x92d6ffe7  libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <411D87F4-B7E1-44EB-F201-F8B4F9227213> /usr/lib/libstdc++.6.dylib
0x93691000 - 0x93691ff7  com.apple.Accelerate 1.6 (Accelerate 1.6) <BC501C9F-7C20-961A-B135-0A457667D03C> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
0x937da000 - 0x937e6ff7  libkxld.dylib ??? (???) <F0E915AD-6B32-0D5E-D24B-B188447FDD23> /usr/lib/system/libkxld.dylib
0x93d7f000 - 0x93deeff7  libvMisc.dylib 268.0.1 (compatibility 1.0.0) <2FC2178F-FEF9-6E3F-3289-A6307B1A154C> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
0x94a6c000 - 0x94a6ffe7  libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <1622A54F-1A98-2CBE-B6A4-2122981A500E> /usr/lib/system/libmathCommon.A.dylib
0x94e5b000 - 0x94f4fff7  libiconv.2.dylib 7.0.0 (compatibility 7.0.0) <9EC28185-D26F-533F-90C4-FBAA13A15947> /usr/lib/libiconv.2.dylib
0x94f50000 - 0x94fadff7  com.apple.framework.IOKit 2.0 (???) <A769737F-E0D6-FB06-29B4-915CF4F43420> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x95d23000 - 0x95d23ff7  com.apple.vecLib 3.6 (vecLib 3.6) <7362077A-890F-3AEF-A8AB-22247B10E106> /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib
0x95fc7000 - 0x9616eff7  libSystem.B.dylib 125.2.1 (compatibility 1.0.0) <62291026-D016-705D-DC1E-FC2B09D47DE5> /usr/lib/libSystem.B.dylib
0x97153000 - 0x97195ff7  libvDSP.dylib 268.0.1 (compatibility 1.0.0) <3F0ED200-741B-4E27-B89F-634B131F5E9E> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
0x97997000 - 0x97a74ff7  com.apple.vImage 4.0 (4.0) <64597E4B-F144-DBB3-F428-0EC3D9A1219E> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
0x97e4c000 - 0x97e60fe7  libbsm.0.dylib ??? (???) <14CB053A-7C47-96DA-E415-0906BA1B78C9> /usr/lib/libbsm.0.dylib
0xffff0000 - 0xffff1fff  libSystem.B.dylib ??? (???) <62291026-D016-705D-DC1E-FC2B09D47DE5> /usr/lib/libSystem.B.dylib


You have to write

Texture2D* _text = [[Texture2D alloc] initWithString:textToDraw dimensions:CGSizeMake(512, 512) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:11];

instead of Texture2D* _text = [[[Texture2D alloc] initWithString:textToDraw dimensions:CGSizeMake(512, 512) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:11] autorelease];

It may be helpful for you.


I'm not sure why, but it's crashing because of the (NSString*)theString argument. For now, although it's inconvenient, if a global variable is set to be displayed instead of a string defined through an argument, the game doesn't crash.

So if I create a separate drawText method for each string I'd like to draw, it will work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜