Sorry if I take again this discussion to your attention, but I had some more details about this.
Please note that all of this has been obtained by simply alternating a start and a stop (enter - esc) command on a movie file in the Videos menu of the standard skin. If you open a top you will see the virt column continuously grow.
In my last session, this is the output of top related to xbmc.bin:
Code:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20955 xbmc 20 0 2915m 568m 29m T 0 37.7 24:18.30 xbmc.bin
in correspondence of a crash. A backtrace informed me that the crash happened when XBMC was trying to create an SDL surface with the following row:
Code:
*ppTexture = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 32, RMASK, GMASK, BMASK, AMASK);
which returned a NULL ppTexture, so that the following row,
Code:
if (SDL_LockSurface(*ppTexture) == 0)
segfaulted. The only reason for the CreateRGBSurface to fail was a malloc failure. I used a simple test program which at every iteration tries to allocate an always increasing chunk of memory, freeing it upon success, and it reaches the malloc limit when it tries to allocate more or less the same amount of memory shown in the top line (actually slightly less - 2815 m).
The complete backtrace was the following:
Code:
#0 0xb7cdf81a in SDL_LockSurface () from /usr/lib/libSDL-1.2.so.0
#1 0x0820b056 in GetTextureFromData (pTex=0xa7b14928, texData=0xbda26088, ppTexture=0xbf9a17cc) at DirectXGraphics.cpp:411
#2 0x082a8e4d in CTextureBundle::LoadTexture (this=0x8bf90b4, Filename=@0x1b3b1ef0, pInfo=0xbf9a173c, ppTexture=0xbf9a17cc, ppPalette=0xbf9a17c8) at TextureBundle.cpp:369
#3 0x082ad5b3 in CGUITextureManager::Load (this=0x8bf9080, strTextureName=@0x1b3b1ef0, checkBundleOnly=false) at TextureManager.cpp:515
#4 0x0828ab98 in CGUITextureBase::AllocResources (this=0x1b3b1e70) at GUITexture.cpp:291
#5 0x08245c8a in CGUIControlGroup::Render (this=0x19e92e38) at GUIControlGroup.cpp:107
#6 0x0822e908 in CGUIControl::DoRender (this=0x19e92e38, currentTime=1399104) at GUIControl.cpp:138
#7 0x08245c6d in CGUIControlGroup::Render (this=0x19e53c28) at GUIControlGroup.cpp:111
#8 0x0822e908 in CGUIControl::DoRender (this=0x19e53c28, currentTime=1399104) at GUIControl.cpp:138
#9 0x08292ba0 in CGUIWindow::Render (this=0xb43672c0) at GUIWindow.cpp:338
#10 0x082e6b4c in CApplication::DoRender (this=0x8bfa320) at Application.cpp:2283
#11 0x0854efe4 in CApplicationRenderer::Render (this=0x8bfbe40, bFullscreen=false) at ApplicationRenderer.cpp:312
#12 0x082da7dd in CApplication::RenderNoPresent (this=0x8bfa320) at Application.cpp:2261
#13 0x082daa1e in CApplication::Render (this=0x8bfa320) at Application.cpp:2479
#14 0x0854054b in CXBApplicationEx::Run (this=0x8bfa320) at XBApplicationEx.cpp:259
#15 0x08540954 in main (argc=3, argv=0xbf9a2544) at xbmc.cpp:129
The log confirms XBMC was trying to create an image
Code:
10:32:44 T:3047782288 M:651059200 DEBUG: ------------------- GUI_MSG_WINDOW_INIT
10:32:44 T:3047782288 M:651059200 DEBUG: Weather
10:32:44 T:3047782288 M:651059200 DEBUG: -------------------
10:32:44 T:3047782288 M:651059200 INFO: Loading skin file: MyWeather.xml
10:32:44 T:3047782288 M:650649600 DEBUG: Load MyWeather.xml: 53.67ms
10:32:44 T:3047782288 M:650649600 DEBUG: LoadFile, loading arrowupnf.png
10:32:44 T:3047782288 M:650649600 DEBUG: Load ArrowUpNF.png: 0.7ms (bundled)
10:32:44 T:3047782288 M:650547200 DEBUG: LoadFile, loading arrowupfo.png
10:32:44 T:3047782288 M:650547200 DEBUG: Load ArrowUpFO.png: 0.6ms (bundled)
10:32:44 T:3047782288 M:650547200 DEBUG: LoadFile, loading arrowdownnf.png
10:32:44 T:3047782288 M:650547200 DEBUG: Load ArrowDownNF.png: 0.6ms (bundled)
10:32:44 T:3047782288 M:650547200 DEBUG: LoadFile, loading arrowdownfo.png
10:32:44 T:3047782288 M:650547200 DEBUG: Load ArrowDownFO.png: 0.6ms (bundled)
10:32:44 T:3047782288 M:650547200 DEBUG: Alloc resources: 60.44ms (55.66 ms skin load)
10:32:44 T:3202010000 M:650547200 NOTICE: Parsing widget thumb:
10:32:44 T:3202010000 M:650547200 NOTICE: Processing key colorkey
10:32:44 T:3202010000 M:650547200 NOTICE: Image: thumb
10:32:44 T:3202010000 M:650547200 NOTICE: Creating image: {u'name': u'thumb', u'visible': u'true', u'height': u'150', u'width': u'150', u'colorkey': u'0xFFFFFFFF', u'y': u'40', u'x': u'80', u'filename': u'ticket_ico.png', 'type': u'image'}
10:32:44 T:3047782288 M:650547200 DEBUG: LoadFile, loading tvfanartoverlay.png
The vast majority of the times this growth of held memory triggers an application freeze. A few times, I had the just described bug.
Any ideas about how to solve this? As I wrote in the first post, it seems that every parameter is set as to free dynamically allocated memory as soon as possible, so I can't understand why all this happens.