Page 1 of 1

DVDpedia 5.0.2 memory leak

Posted: Sat Feb 25, 2012 1:16 pm
by petriv
DVDpedia 5.0.2 apparently has some issues with memory management. I had just launched the program and was manually adding disc details when DVDpedia started beachballing.

It seems it went into a vicious cycle where it would rapidly allocate and release large amounts of memory; then, during the last cycle the process size will grow up to 2.6 gigabytes and then the process hangs.

I have seen this kind of behavior also with Bookpedia 5.

Some observations:

Image showing the memory cycle. Memory allocation rate is approximately 10-20 megabytes per second: http://aijaa.com/006439642885

Stack trace showing related error messages:

Code: Select all

25.02.2012 12:51:37.464 PM DVDpedia: Call stack: (
	0   Pediabase                           0xc0f97871 -[NSException(NSExceptionExtensions) printStackTrace] + 118
	1   Pediabase                           0xc0f33c2a -[MyControllerShared(ApplicationNotifications) exceptionHandler:shouldHandleException:mask:] + 120
	2   ExceptionHandling                   0x001b0016 -[NSExceptionHandler _handleException:mask:] + 1692
	3   ExceptionHandling                   0x001af972 -[NSExceptionHandler _createAndHandleUncaughtSystemExceptionWithSignal:pc:sp:] + 277
	4   ExceptionHandling                   0x001b02fd NSExceptionHandlerUncaughtSignalHandler + 60
	5   libsystem_c.dylib                   0x98e5b59b _sigtramp + 43
	6   ???                                 0xffffffff 0x0 + 4294967295
	7   CoreVideo                           0x951d0f0b _ZN20CVPixelBufferBacking16provideImageDataEPvmmmmm + 135
	8   CoreVideo                           0x951c8161 CVImageBufferProvideImageData + 79
	9   CoreImage                           0x9aac64f7 -[CICVImageProviderDelegate provideImageData:bytesPerRow:origin::size::userInfo:] + 95
	10  CoreImage                           0x9aadeb6d __provide_bitmap_block_invoke_0 + 199
	11  libdispatch.dylib                   0x9cc03126 _dispatch_barrier_sync_f_invoke + 30
	12  libdispatch.dylib                   0x9cc035b6 dispatch_barrier_sync_f + 87
	13  libdispatch.dylib                   0x9cc0370c dispatch_sync + 45
	14  CoreImage                           0x9aade6a1 _Z14provide_bitmapPK25fe_bitmap_provider_struct + 78
	15  CoreImage                           0x9ab4336d _Z21fe_bitmap_ensure_dataP16fe_bitmap_struct + 48
	16  CoreImage                           0x9ac4ba1a _ZN18FEOpenGLBitmapTile4tileEP15FEOpenGLContextP16fe_bitmap_structjP20FETiledBitmapToken_sa + 26
	17  CoreImage                           0x9ab0981c -[FEOpenGLContext(Texture) _textureForBitmap:bounds:target:wrapMode:filterMode:buffer:] + 3801
	18  CoreImage                           0x9ac11b4b -[FEContext(Texture) textureForBitmap:bounds:target:wrapMode:filterMode:buffer:] + 358
	19  CoreImage                           0x9ab0def6 -[FEBufferImage _createTextureWithContext:bounds:target:wrapMode:filterMode:buffer:] + 305
	20  CoreImage                           0x9ab1366c -[FEImage(Internal) createTextureWithContext:bounds:target:wrapMode:filterMode:buffer:] + 268
	21  CoreImage                           0x9ab31699 _ZN9FETexture19retainTextureObjectEP14FETextureCacheP9FEContextjPvPFvS4_6CGRect8FEFormatPFvS3_S4_S6_EPFvS3_S4_ES4_EPKS5_bPP24fe_texture_object_struct + 675
	22  CoreImage                           0x9ab3207b _ZN9FETexture10newTextureEP9FEContextPK24fe_texture_params_structPvPFvS5_6CGRect8FEFormatPFvS1_S5_S7_EPFvS1_S5_ES5_EPP24fe_texture_object_struct + 1037
	23  CoreImage                           0x9ab372ad _ZN10FETreeNode13createTextureEP13FETreeContextjjbbP13FETreeTexturej + 867
	24  CoreImage                           0x9ab39760 _ZN15FEApplyTreeNode7render2EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 626
	25  CoreImage                           0x9ab36e4b _ZN10FETreeNode7render_EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 119
	26  CoreImage                           0x9ab36f2d _ZN10FETreeNode13renderTextureEPv6CGRect8FEFormatPFvP9FEContextS0_S2_EPFvS4_S0_ES0_ + 85
	27  CoreImage                           0x9ab315bc _ZN9FETexture19retainTextureObjectEP14FETextureCacheP9FEContextjPvPFvS4_6CGRect8FEFormatPFvS3_S4_S6_EPFvS3_S4_ES4_EPKS5_bPP24fe_texture_object_struct + 454
	28  CoreImage                           0x9ab3207b _ZN9FETexture10newTextureEP9FEContextPK24fe_texture_params_structPvPFvS5_6CGRect8FEFormatPFvS1_S5_S7_EPFvS1_S5_ES5_EPP24fe_texture_object_struct + 1037
	29  CoreImage                           0x9ab372ad _ZN10FETreeNode13createTextureEP13FETreeContextjjbbP13FETreeTexturej + 867
	30  CoreImage                           0x9ab37cc6 _ZN22FEImageOrUnaryTreeNode7render2EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 894
	31  CoreImage                           0x9ab36e4b _ZN10FETreeNode7render_EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 119
	32  CoreImage                           0x9ab39e3b _ZN20FESourceOverTreeNode7render2EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 277
	33  CoreImage                           0x9ab36e4b _ZN10FETreeNode7render_EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 119
	34  CoreImage                           0x9ab36f2d _ZN10FETreeNode13renderTextureEPv6CGRect8FEFormatPFvP9FEContextS0_S2_EPFvS4_S0_ES0_ + 85
	35  CoreImage                           0x9ab315bc _ZN9FETexture19retainTextureObjectEP14FETextureCacheP9FEContextjPvPFvS4_6CGRect8FEFormatPFvS3_S4_S6_EPFvS3_S4_ES4_EPKS5_bPP24fe_texture_object_struct + 454
	36  CoreImage                           0x9ab3207b _ZN9FETexture10newTextureEP9FEContextPK24fe_texture_params_structPvPFvS5_6CGRect8FEFormatPFvS1_S5_S7_EPFvS1_S5_ES5_EPP24fe_texture_object_struct + 1037
	37  CoreImage                           0x9ab372ad _ZN10FETreeNode13createTextureEP13FETreeContextjjbbP13FETreeTexturej + 867
	38  CoreImage                           0x9ab39760 _ZN15FEApplyTreeNode7render2EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 626
	39  CoreImage                           0x9ab36e4b _ZN10FETreeNode7render_EP13FETreeContextPK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 119
	40  CoreImage                           0x9ab3a811 _ZN10FETreeNode6renderEP13FETreeContextRK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 97
	41  CoreImage                           0x9ab3a7aa _ZN13FETreeContext6renderEP10FETreeNodeRK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 52
	42  CoreImage                           0x9ab3e0c3 _ZN13FETreeContext10renderTreeEP10FETreeNodeRK7FEShapePFvP9FEContextPv8FEFormatEPFvS6_S7_ES7_ + 189
	43  CoreImage                           0x9ab3e3b0 _ZN13FETreeContext12renderImage_EP7FEImage6CGRectPK7FEShape17CGAffineTransformP12CGColorSpace8FEFormatbPFvP9FEContextPvS9_EPFvSB_SC_ESC_ + 686
	44  CoreImage                           0x9ab3e61b _ZN13FETreeContext11renderImageEP7FEImage6CGRectPK7FEShape17CGAffineTransformP12CGColorSpace8FEFormatbPFvP9FEContextPvS9_EPFvSB_SC_ESC_ + 361
	45  CoreImage                           0x9ab1379a -[FEImage(Internal) _renderWithContext:bounds:transform:colorSpace:format:premultiplied:setupCallback:finishCallback:callbackData:] + 273
	46  CoreImage                           0x9ab1325b -[FEImage renderToContext:bounds:transform:destinationFormat:colorSpace:] + 221
	47  CoreImage                           0x9aac522a _Z11renderImageP9FEContext6CGRect17CGAffineTransformjPv + 169
	48  CoreImage                           0x9aae1401 -[CIOpenGLContextImpl renderWithBounds:matrix:function:info:] + 222
	49  CoreImage                           0x9aac5179 -[CIContextImpl render:] + 192
	50  CoreImage                           0x9aac3205 -[CIContext drawImage:inRect:fromRect:] + 1311
	51  CoreImage                           0x9aac34c6 -[CIContext drawImage:atPoint:fromRect:] + 144
	52  Pediabase                           0xc100d691 -[SampleCIView drawRect:] + 872
	53  AppKit                              0x9bbe0295 -[NSView _drawRect:clip:] + 3717
	54  AppKit                              0x9bc0fc32 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1958
	55  AppKit                              0x9bbddbf2 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 708
	56  AppKit                              0x9bbded5f -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5169
	57  AppKit                              0x9bbdd1f3 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 259
	58  AppKit                              0x9bbd887c -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4817
	59  AppKit                              0x9bbd179f -[NSView displayIfNeeded] + 1365
	60  AppKit                              0x9bbce56d -[NSWindow displayIfNeeded] + 316
	61  AppKit                              0x9bbd1070 _handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 804
	62  CoreFoundation                      0x997def8d _runLoopObserverWithBlockContext + 29
	63  CoreFoundation                      0x997ab47e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
	64  CoreFoundation                      0x997ab3bd __CFRunLoopDoObservers + 413
	65  CoreFoundation                      0x9977dc24 __CFRunLoopRun + 1044
	66  CoreFoundation                      0x9977d47c CFRunLoopRunSpecific + 332
	67  CoreFoundation                      0x9977d328 CFRunLoopRunInMode + 120
	68  HIToolbox                           0x9863f17f RunCurrentEventLoopInMode + 318
	69  HIToolbox                           0x986464e7 ReceiveNextEventCommon + 381
	70  HIToolbox                           0x98646356 BlockUntilNextEventMatchingListInMode + 88
	71  AppKit                              0x9bb90a9c _DPSNextEvent + 678
	72  AppKit                              0x9bb90306 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 113
	73  AppKit                              0x9bb8c675 -[NSApplication run] + 911
	74  AppKit                              0x9be20261 NSApplicationMain + 1054
	75  DVDpedia                            0x00002c35 DVDpedia + 7221
	76  ???                                 0x00000002 0x0 + 2
)



Feb 25 12:51:37 rainbow [0x0-0x1e11e1].com.bruji.dvdpedia[4441]: DVDpedia(4441,0xb0081000) malloc: *** auto malloc[4441]: Zone::Can not allocate 0x97000 bytes
Feb 25 12:52:56: --- last message repeated 54 times ---
Feb 25 12:52:56 rainbow [0x0-0x1e11e1].com.bruji.dvdpedia[4441]: DVDpedia(4441,0xb0081000) malloc: *** auto malloc[4441]: Zone::Can not allocate 0x97000 bytes
Feb 25 12:53:32: --- last message repeated 217 times ---
Feb 25 12:57:47 rainbow [0x0-0x1e11e1].com.bruji.dvdpedia[4441]: DVDpedia(4441,0xb0081000) malloc: *** auto malloc[4441]: Zone::Can not allocate 0x97000 bytes
Feb 25 12:58:17: --- last message repeated 446 times ---
Feb 25 12:58:17 rainbow [0x0-0x1e11e1].com.bruji.dvdpedia[4441]: DVDpedia(4441,0xb0081000) malloc: *** auto malloc[4441]: Zone::Can not allocate 0x97000 bytes
Feb 25 12:58:47: --- last message repeated 447 times ---


Re: DVDpedia 5.0.2 memory leak

Posted: Sat Feb 25, 2012 2:07 pm
by petriv
OK, I was able to narrow this problem to iSight window. Whenever I activate iSight, the process memory consumption explodes.

Initially, when started, DVDpedia takes approx. 30 MB of memory. After activating iSight the memory allocation grows to 1023 MB in one minute and to 2.02 GB during the next one minute. After reaching 2.6 gigabytes, the process hangs completely.

Re: DVDpedia 5.0.2 memory leak

Posted: Sat Feb 25, 2012 3:26 pm
by Conor
Thank you for all the details I see it in the logs as being something to do with the display of the image in the preview window, but haven't been able to repeat it. I'll keep testing and let you know if I can track anything down. What version of OS X are you running?

Re: DVDpedia 5.0.2 memory leak

Posted: Sun Feb 26, 2012 8:52 am
by Conor
Thank you for all the details. I updated DVDpedia to send more explicits instructions to the garbage collector. The garbage collector should normally kick in by default but in some cases it was growing past the threshold. Please try out the DVDpedia beta 23 and let me know if you still see the same issue. Bookpedia beta 19 is also updated if you would like to test that one out.

Re: DVDpedia 5.0.2 memory leak

Posted: Sun Feb 26, 2012 11:37 am
by petriv
Well, now the problem seems to be solved in beta versions. For what it's worth, I'm using OS X 10.7.3

Thank you.