Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when trying to start game #122

Open
denispapec opened this issue Oct 1, 2017 · 14 comments
Open

Segmentation fault when trying to start game #122

denispapec opened this issue Oct 1, 2017 · 14 comments
Assignees
Labels

Comments

@denispapec
Copy link
Contributor

(gdb) run
Starting program: /home/denis/OpenClaw/Build_Release/openclaw 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
WARN: [RunGameEngine] Failed to set high priority class to this process
INFO: Looking for: /home/denis/.config/openclaw/config.xml
INFO: Expecting config.xml in path: config.xml
INFO: Loaded with:
	Config File: config.xml
	Saves File: SAVES.XML
INFO: >>>>> Initializing display...
[New Thread 0x7ffff49f5700 (LWP 14271)]
[New Thread 0x7fffe9736700 (LWP 14272)]
[New Thread 0x7fffe8f35700 (LWP 14273)]
[New Thread 0x7fffe3fff700 (LWP 14274)]
[New Thread 0x7fffe37fe700 (LWP 14275)]
[New Thread 0x7fffe2ffd700 (LWP 14276)]
[New Thread 0x7fffe27fc700 (LWP 14277)]
[New Thread 0x7fffe1ffb700 (LWP 14278)]
[New Thread 0x7fffe17fa700 (LWP 14279)]
[New Thread 0x7ffff7fbb700 (LWP 14280)]
INFO: Display successfully initialized.
INFO: >>>>> Initializing audio...
[New Thread 0x7fffc6b4c700 (LWP 14475)]
INFO: Audio successfully initialized.
INFO: >>>>> Initializing font...
INFO: Font successfully initialized...
INFO: >>>>> Initializing resource cache...
INFO: Resource cache successfully initialized
INFO: >>>>> Loading actor prototypes...
INFO: Actor prototypes loaded successfully.

Thread 1 "openclaw" received signal SIGSEGV, Segmentation fault.
0x00007ffff78d7e28 in ?? () from /usr/lib/libSDL2-2.0.so.0

@pjasicek
Copy link
Owner

pjasicek commented Oct 2, 2017

I have no problems running it on Fedora 26 with latest commit. I accidentally deleted my Ubuntu development VM, so when I'll set it up, I'll try it on Ubuntu. But I cannot see where the problem is.

@jstasiak
Copy link

jstasiak commented Oct 2, 2017

I'm also experiencing a segfault now (commit 8485fa8) on macos:

% lldb ./openclaw 
(lldb) target create "./openclaw"
Current executable set to './openclaw' (x86_64).
(lldb) run
Process 9400 launched: './openclaw' (x86_64)
2017-10-03 01:00:50.344245+0200 openclaw[9400:935179] INFO: Looking for: config.xml
2017-10-03 01:00:50.346207+0200 openclaw[9400:935179] INFO: Expecting config.xml in path: config.xml
2017-10-03 01:00:50.346539+0200 openclaw[9400:935179] INFO: Loaded with:
	Config File: config.xml
	Saves File: SAVES.XML
2017-10-03 01:00:50.346576+0200 openclaw[9400:935179] INFO: >>>>> Initializing display...
2017-10-03 01:00:50.881572+0200 openclaw[9400:935179] INFO: Display successfully initialized.
2017-10-03 01:00:50.881620+0200 openclaw[9400:935179] INFO: >>>>> Initializing audio...
2017-10-03 01:00:51.034517+0200 openclaw[9400:935179] INFO: Audio successfully initialized.
2017-10-03 01:00:51.034580+0200 openclaw[9400:935179] INFO: >>>>> Initializing font...
2017-10-03 01:00:51.035131+0200 openclaw[9400:935179] INFO: Font successfully initialized...
2017-10-03 01:00:51.035169+0200 openclaw[9400:935179] INFO: >>>>> Initializing resource cache...
2017-10-03 01:00:51.419990+0200 openclaw[9400:935179] INFO: Resource cache successfully initialized
2017-10-03 01:00:51.420032+0200 openclaw[9400:935179] INFO: >>>>> Loading actor prototypes...
2017-10-03 01:00:51.432443+0200 openclaw[9400:935179] INFO: Actor prototypes loaded successfully.
Process 9400 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7fff5fc00000)
    frame #0: 0x00000001003750f8 libSDL2-2.0.0.dylib`SDL_ResampleAudio + 804
libSDL2-2.0.0.dylib`SDL_ResampleAudio:
->  0x1003750f8 <+804>: mulss  (%rdx), %xmm7
    0x1003750fc <+808>: addss  %xmm7, %xmm6
    0x100375100 <+812>: incq   %rcx
    0x100375103 <+815>: addq   %r15, %rsi
Target 0: (openclaw) stopped.
(lldb) thread backtrace 
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7fff5fc00000)
  * frame #0: 0x00000001003750f8 libSDL2-2.0.0.dylib`SDL_ResampleAudio + 804
    frame #1: 0x0000000100374d7c libSDL2-2.0.0.dylib`SDL_ResampleCVT + 221
    frame #2: 0x0000000100373284 libSDL2-2.0.0.dylib`SDL_ConvertAudio_REAL + 39
    frame #3: 0x000000010043c11e libSDL2_mixer-2.0.0.dylib`Mix_LoadWAV_RW + 587
    frame #4: 0x00000001000b9d7d openclaw`WavResourceLoader::VGetLoadedResourceSize(this=<unavailable>, rawBuffer=<unavailable>, rawSize=<unavailable>) at WavLoader.cpp:65 [opt]
    frame #5: 0x00000001000a694b openclaw`ResourceCache::Load(this=0x0000000104f6ffe0, r=0x00007fff5fbff218) at ResourceCache.cpp:344 [opt]
    frame #6: 0x00000001000a60bc openclaw`ResourceCache::GetHandle(this=0x0000000104f6ffe0, r=0x00007fff5fbff218) at ResourceCache.cpp:277 [opt]
    frame #7: 0x00000001000a7ac8 openclaw`ResourceCache::Preload(this=0x0000000104f6ffe0, pattern=<unavailable>, progressCallback=0x0000000000000000)(int, bool&)) at ResourceCache.cpp:520 [opt]
    frame #8: 0x000000010008175b openclaw`BaseGameApp::Initialize(this=0x00000001001866b0, argc=<unavailable>, argv=<unavailable>) at BaseGameApp.cpp:77 [opt]
    frame #9: 0x000000010009a049 openclaw`RunGameEngine(argc=1, argv=0x00007fff5fbff718) at MainLoop.cpp:61 [opt]
    frame #10: 0x00007fffbf9e1235 libdyld.dylib`start + 1
    frame #11: 0x00007fffbf9e1235 libdyld.dylib`start + 1

(lldb) register read
General Purpose Registers:
       rax = 0x0000000000000001
       rbx = 0x0000000102114874
       rcx = 0x0000000000000004
       rdx = 0x00007fff5fc00000
       rdi = 0x000000000004fbac
       rsi = 0x000000010e9b8eb0
       rbp = 0x00007fff5fbfe6e0
       rsp = 0x00007fff5fbfe5f0
        r8 = 0xfffffffffffffffc
        r9 = 0x0000000000000001
       r10 = 0x0000000102117274
       r11 = 0x00007fff5fbfe710
       r12 = 0x0000000000000000
       r13 = 0x000000000004fba8
       r14 = 0x000000000004f570
       r15 = 0x0000000000000004
       rip = 0x00000001003750f8  libSDL2-2.0.0.dylib`SDL_ResampleAudio + 804
    rflags = 0x0000000000210206
        cs = 0x000000000000002b
        fs = 0x0000000000000000
        gs = 0x0000000000000000

@pjasicek
Copy link
Owner

pjasicek commented Oct 3, 2017

Try it with 75b0af3 please, but I am not sure it will solve it, since the segfault on your end is bound to loading some WAV.

If this does not help, please add a debug log to the beginning of Engine/Resource/Loaders/WavResourceLoader::VGetLoadedResourceSize method to print the name of the resource for which it is failing, e.g.:

[Line 46]: LOG("Trying to load: " + handle->GetName());

and run it again and post the log here. Thanks.

@pjasicek pjasicek self-assigned this Oct 3, 2017
@pjasicek pjasicek added the bug label Oct 3, 2017
@pjasicek
Copy link
Owner

pjasicek commented Oct 3, 2017

Works / worked for me also on clean debian distro btw.

@denispapec
Copy link
Contributor Author

Ok, i've found something, segfault appeared with sdl2 package upgrade from 2.0.5-4 to 2.0.6-1. Still works fine when i downgrade the package version.

(gdb) bt
#0  0x00007ffff78d7e28 in ?? () from /usr/lib/libSDL2-2.0.so.0
#1  0x00007ffff78d8026 in ?? () from /usr/lib/libSDL2-2.0.so.0
#2  0x00007ffff78d8557 in ?? () from /usr/lib/libSDL2-2.0.so.0
#3  0x00007ffff7675480 in Mix_LoadWAV_RW () from /usr/lib/libSDL2_mixer-2.0.so.0
#4  0x00005555556df32d in WavResourceLoader::VGetLoadedResourceSize (this=<optimized out>, rawBuffer=<optimized out>, rawSize=<optimized out>)
    at /home/denis/OpenClaw/OpenClaw/Engine/Resource/Loaders/WavLoader.cpp:65
#5  0x00005555556ca0c1 in ResourceCache::Load (this=this@entry=0x5555561dd970, r=r@entry=0x7fffffffdd80) at /home/denis/OpenClaw/OpenClaw/Engine/Resource/ResourceCache.cpp:344
#6  0x00005555556cbbfe in ResourceCache::GetHandle (this=this@entry=0x5555561dd970, r=r@entry=0x7fffffffdd80) at /home/denis/OpenClaw/OpenClaw/Engine/Resource/ResourceCache.cpp:277
#7  0x00005555556cbefd in ResourceCache::Preload (this=this@entry=0x5555561dd970, pattern="/STATES/*", progressCallback=progressCallback@entry=0x0)
    at /home/denis/OpenClaw/OpenClaw/Engine/Resource/ResourceCache.cpp:520
#8  0x00005555556a486d in BaseGameApp::Initialize (this=0x5555559d1940 <testApp>, argc=<optimized out>, argv=<optimized out>) at /home/denis/OpenClaw/OpenClaw/Engine/GameApp/BaseGameApp.cpp:77
#9  0x00005555556b8754 in RunGameEngine (argc=1, argv=0x7fffffffe2b8) at /home/denis/OpenClaw/OpenClaw/Engine/GameApp/MainLoop.cpp:61
#10 0x00007ffff63aff6a in __libc_start_main () from /usr/lib/libc.so.6
#11 0x00005555555ee6aa in _start ()

Full log with log on line 46, as there is no handle variable in VGetLoadedResourceSize method. menubed.wav doesn't seem to be loaded.

WARN: [RunGameEngine] Failed to set high priority class to this process
INFO: Looking for: /home/denis/.config/openclaw/config.xml
INFO: Expecting config.xml in path: config.xml
INFO: Loaded with:
	Config File: config.xml
	Saves File: SAVES.XML
INFO: >>>>> Initializing display...
INFO: Display successfully initialized.
INFO: >>>>> Initializing audio...
INFO: Audio successfully initialized.
INFO: >>>>> Initializing font...
INFO: Font successfully initialized...
INFO: >>>>> Initializing resource cache...
INFO: Resource cache successfully initialized
INFO: >>>>> Loading actor prototypes...
INFO: Actor prototypes loaded successfully.
INFO: Trying to load: /claw/sounds/drygunshot1.wav
INFO: Trying to load: /claw/sounds/1110056.wav
INFO: Trying to load: /claw/sounds/1110037.wav
INFO: Trying to load: /claw/sounds/dynathrw.wav
INFO: Trying to load: /claw/sounds/1110057.wav
INFO: Trying to load: /claw/sounds/1110038.wav
INFO: Trying to load: /claw/sounds/emptymagic.wav
INFO: Trying to load: /claw/sounds/1110058.wav
INFO: Trying to load: /claw/sounds/1110001.wav
INFO: Trying to load: /claw/sounds/1009.wav
INFO: Trying to load: /claw/sounds/falldeath.wav
INFO: Trying to load: /claw/sounds/1110059.wav
INFO: Trying to load: /claw/sounds/1010.wav
INFO: Trying to load: /claw/sounds/firesword.wav
INFO: Trying to load: /claw/sounds/1110022.wav
INFO: Trying to load: /claw/sounds/grunt2.wav
INFO: Trying to load: /claw/sounds/gruntthrow.wav
INFO: Trying to load: /claw/sounds/1110043.wav
INFO: Trying to load: /claw/sounds/gunshot.wav
INFO: Trying to load: /claw/sounds/1110063.wav
INFO: Trying to load: /claw/sounds/hitathih.wav
INFO: Trying to load: /claw/sounds/1110064.wav
INFO: Trying to load: /claw/sounds/1110045.wav
INFO: Trying to load: /claw/sounds/hitatlow.wav
INFO: Trying to load: /claw/sounds/1054.wav
INFO: Trying to load: /claw/sounds/icesword.wav
INFO: Trying to load: /claw/sounds/1055.wav
INFO: Trying to load: /claw/sounds/land.wav
INFO: Trying to load: /claw/sounds/1110048.wav
INFO: Trying to load: /claw/sounds/1056.wav
INFO: Trying to load: /claw/sounds/leftfoot1.wav
INFO: Trying to load: /claw/sounds/1110049.wav
INFO: Trying to load: /claw/sounds/1057.wav
INFO: Trying to load: /claw/sounds/leftswing1.wav
INFO: Trying to load: /claw/sounds/1110050.wav
INFO: Trying to load: /claw/sounds/1110012.wav
INFO: Trying to load: /claw/sounds/1058.wav
INFO: Trying to load: /claw/sounds/1001.wav
INFO: Trying to load: /claw/sounds/lightsword.wav
INFO: Trying to load: /claw/sounds/1110051.wav
INFO: Trying to load: /claw/sounds/1021.wav
INFO: Trying to load: /claw/sounds/1002.wav
INFO: Trying to load: /claw/sounds/null.wav
INFO: Trying to load: /claw/sounds/1110033.wav
INFO: Trying to load: /claw/sounds/1004a.wav
INFO: Trying to load: /claw/sounds/1003.wav
INFO: Trying to load: /claw/sounds/rightfoot1.wav
INFO: Trying to load: /claw/sounds/1004b.wav
INFO: Trying to load: /claw/sounds/swordswish.wav
INFO: Trying to load: /claw/sounds/1110035.wav
INFO: Trying to load: /claw/sounds/1062.wav
INFO: Trying to load: /claw/sounds/1007a.wav
INFO: Trying to load: /claw/sounds/uppercut1.wav
INFO: Trying to load: /claw/sounds/1007b.wav
INFO: Trying to load: /game/sounds/solhithi.wav
INFO: Trying to load: /game/sounds/minorcheat.wav
INFO: Trying to load: /game/sounds/cursed.wav
INFO: Trying to load: /game/sounds/boinkjr.wav
INFO: Trying to load: /game/sounds/solhitl2.wav
INFO: Trying to load: /game/sounds/mlf.wav
INFO: Trying to load: /game/sounds/disable.wav
INFO: Trying to load: /game/sounds/bombexp.wav
INFO: Trying to load: /game/sounds/splash.wav
INFO: Trying to load: /game/sounds/monolith.wav
INFO: Trying to load: /game/sounds/eehh.wav
INFO: Trying to load: /game/sounds/bombfly.wav
INFO: Trying to load: /game/sounds/thrwbomb.wav
INFO: Trying to load: /game/sounds/moused.wav
INFO: Trying to load: /game/sounds/enemyj.wav
INFO: Trying to load: /game/sounds/castcurse.wav
INFO: Trying to load: /game/sounds/treasure.wav
INFO: Trying to load: /game/sounds/mousekill.wav
INFO: Trying to load: /game/sounds/extralife.wav
INFO: Trying to load: /game/sounds/catnmag.wav
INFO: Trying to load: /game/sounds/warp.wav
INFO: Trying to load: /game/sounds/mrf.wav
INFO: Trying to load: /game/sounds/flagrise.wav
INFO: Trying to load: /game/sounds/circlefade.wav
INFO: Trying to load: /game/sounds/newmessage.wav
INFO: Trying to load: /game/sounds/flagwave.wav
INFO: Trying to load: /game/sounds/click.wav
INFO: Trying to load: /game/sounds/nipdown2.wav
INFO: Trying to load: /game/sounds/fooditem.wav
INFO: Trying to load: /game/sounds/coin.wav
INFO: Trying to load: /game/sounds/nipup2.wav
INFO: Trying to load: /game/sounds/hit1.wav
INFO: Trying to load: /game/sounds/coinching.wav
INFO: Trying to load: /game/sounds/null.wav
INFO: Trying to load: /game/sounds/hit2.wav
INFO: Trying to load: /game/sounds/cratebreak.wav
INFO: Trying to load: /game/sounds/pickup1.wav
INFO: Trying to load: /game/sounds/hit3.wav
INFO: Trying to load: /game/sounds/cratebreak2.wav
INFO: Trying to load: /game/sounds/1055.wav
INFO: Trying to load: /game/sounds/pickup2.wav
INFO: Trying to load: /game/sounds/hit4.wav
INFO: Trying to load: /game/sounds/cratedamage.wav
INFO: Trying to load: /game/sounds/pubounce1.wav
INFO: Trying to load: /game/sounds/holdaim.wav
INFO: Trying to load: /game/sounds/cross.wav
INFO: Trying to load: /game/sounds/purelease1.wav
INFO: Trying to load: /game/sounds/kegboom.wav
INFO: Trying to load: /game/sounds/curse1.wav
INFO: Trying to load: /game/sounds/rings.wav
INFO: Trying to load: /game/sounds/leland.wav
INFO: Trying to load: /game/sounds/curse2.wav
INFO: Trying to load: /game/sounds/scepter.wav
INFO: Trying to load: /game/sounds/magicpowerup.wav
INFO: Trying to load: /game/sounds/curse3.wav
INFO: Trying to load: /game/sounds/ammunition.wav
INFO: Trying to load: /game/sounds/sdpt1.wav
INFO: Trying to load: /game/sounds/majorcheat.wav
INFO: Trying to load: /game/sounds/curse4.wav
INFO: Trying to load: /game/sounds/amuletrise.wav
INFO: Trying to load: /game/sounds/sdpt2.wav
INFO: Trying to load: /game/sounds/mappiece.wav
INFO: Trying to load: /game/sounds/curse5.wav
INFO: Trying to load: /game/sounds/block2.wav
INFO: Trying to load: /game/sounds/select.wav
INFO: Trying to load: /game/sounds/milk.wav
INFO: Trying to load: /game/sounds/curse6.wav
INFO: Trying to load: /game/sounds/boink.wav
INFO: Trying to load: /states/booty/sounds/coin.wav
INFO: Trying to load: /states/booty/sounds/cross.wav
INFO: Trying to load: /states/booty/sounds/curling1.wav
INFO: Trying to load: /states/booty/sounds/foot2.wav
INFO: Trying to load: /states/booty/sounds/foot3.wav
INFO: Trying to load: /states/booty/sounds/gem.wav
INFO: Trying to load: /states/booty/sounds/impact3.wav
INFO: Trying to load: /states/booty/sounds/maploop.wav
INFO: Trying to load: /states/booty/sounds/perfect.wav
INFO: Trying to load: /states/booty/sounds/pickup1.wav
INFO: Trying to load: /states/booty/sounds/pickup2.wav
INFO: Trying to load: /states/booty/sounds/rings.wav
INFO: Trying to load: /states/booty/sounds/scepter.wav
INFO: Trying to load: /states/booty/sounds/treasure.wav
INFO: Trying to load: /states/booty/sounds/ammake.wav
INFO: Trying to load: /states/booty/sounds/amulet.wav
INFO: Trying to load: /states/booty/sounds/bounce1.wav
INFO: Trying to load: /states/booty/sounds/catnmag.wav
INFO: Trying to load: /states/booty/sounds/claw/1110002.wav
INFO: Trying to load: /states/booty/sounds/claw/1110003.wav
INFO: Trying to load: /states/booty/sounds/claw/1110023.wav
INFO: Trying to load: /states/booty/sounds/claw/1110004.wav
INFO: Trying to load: /states/booty/sounds/claw/1110024.wav
INFO: Trying to load: /states/booty/sounds/claw/1110005.wav
INFO: Trying to load: /states/booty/sounds/claw/1110025.wav
INFO: Trying to load: /states/booty/sounds/claw/1110006.wav
INFO: Trying to load: /states/booty/sounds/claw/1110026.wav
INFO: Trying to load: /states/booty/sounds/claw/1110007.wav
INFO: Trying to load: /states/booty/sounds/claw/1110027.wav
INFO: Trying to load: /states/booty/sounds/claw/1110008.wav
INFO: Trying to load: /states/booty/sounds/claw/1110028.wav
INFO: Trying to load: /states/booty/sounds/claw/1110009.wav
INFO: Trying to load: /states/racing/sounds/unroll.wav
INFO: Trying to load: /states/racing/sounds/delayunroll.wav
INFO: Trying to load: /states/racing/sounds/newplayer.wav
INFO: Trying to load: /states/racing/sounds/rollup.wav
INFO: Trying to load: /states/racing/sounds/select.wav
INFO: Trying to load: /states/credits/sounds/delayunroll.wav
INFO: Trying to load: /states/credits/sounds/rollup.wav
INFO: Trying to load: /states/credits/sounds/unroll.wav
INFO: Trying to load: /states/attract/sounds/select.wav
INFO: Trying to load: /states/attract/sounds/title.wav
INFO: Trying to load: /states/attract/sounds/unroll.wav
INFO: Trying to load: /states/attract/sounds/coinching.wav
INFO: Trying to load: /states/attract/sounds/delayunroll.wav
INFO: Trying to load: /states/attract/sounds/disable.wav
INFO: Trying to load: /states/attract/sounds/rollup.wav
INFO: Trying to load: /states/menu/sounds/disable.wav
INFO: Trying to load: /states/menu/sounds/intro.wav
[1]    14050 segmentation fault (core dumped)  ./openclaw

@pjasicek
Copy link
Owner

pjasicek commented Oct 3, 2017

Thanks for the update. I will try to reproduce it with that SDL2 version.

@pjasicek
Copy link
Owner

pjasicek commented Oct 4, 2017

SDL2 guys must have broken something since I am not the only one with this problem:

https://discourse.libsdl.org/t/sdl-2-0-6-released/23109/18

@jstasiak
Copy link

jstasiak commented Oct 4, 2017

Yeah I'm also using SDL 2.0.6 so this seems to be it.

@fragglet
Copy link

fragglet commented Oct 5, 2017

Hello! Please see this bug I filed with SDL:

https://bugzilla.libsdl.org/show_bug.cgi?id=3858

@pjasicek
Copy link
Owner

pjasicek commented Oct 5, 2017

@fragglet , great ! Let's hope they will issue some hotfix.

By the way, it works fine for me on Windows but it crashes on all linux distros.

Also on Windows when using the 2.0.6 version, the memory footprint of the game is almost 5 times greater than with 2.0.5 (with 2.0.5 it uses around 80-90 MBs of memory, with 2.0.6 it uses around 400 MBs) - this may be caused by wrong mixing specs described below after Mixer initialization, as all WAVs blow up in size 8 times.

Another thing is that when using 2.0.6 and doing:

Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 1, 2048)

it disregards the options and instead the actual values after doing Mix_QuerySpec are:

Frequency - 48000
Format - 0x8120 (it does not fit any of the defined formats)
Channels - 2

This does not problem with 2.0.5 version.

@pjasicek
Copy link
Owner

pjasicek commented Nov 7, 2018

When I update SDL version on windows, the game's memory footprint goes from 80MB to 400-500MB for some reason.

Not sure if this is same for linux as I dont have native linux machine, only one emulated in vmware (which does not store textures in GPU but rather in memory)

@denispapec
Copy link
Contributor Author

Hm, interesting, it looks like it utilizes memory far more than GPU on Linux.
At the start of the game:

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1246      G   /usr/lib/Xorg                                277MiB |
|    0     17561      G   ./openclaw                                     3MiB |
+-----------------------------------------------------------------------------+

after 10th level was loaded (with SDL 2.0.4):

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1246      G   /usr/lib/Xorg                                285MiB |
|    0     31762      G   ./openclaw                                    80MiB |
+-----------------------------------------------------------------------------+

I went to see also memory footprint when level was loaded and right before level was finished:

Level RAM at level start (MB) RAM at level end (MB)
1 301 325
2 378 394
3 502 -

Since playing the game until end of the level would take some time, i started to record RAM usage only after level was loaded:

Level SDL2 2.0.9 (MB) SDL2 2.0.4 (MB) SDL2 2.0.4 (MB, second time)
main menu 191 173 123
1 301 263 214
2 363 302 252
3 477 395 346
4 514 402 353
5 677 542 495
6 716 615 566
7 794 616 567
8 909 674 624
9 966 727 678
10 1000 745 696

If someone wants to test this also, this is what i used to get memory footprint:
ps -o rss= <process_id> | awk '{printf "%.0f\n", $1 / 1024}'

@pjasicek
Copy link
Owner

pjasicek commented Nov 7, 2018

Yeah I have some major memory leaks scattered throughout the codebase... Mainly it's from bad approach to sprite/sound caching I think.

At some points I fixed some leaks, but rather high memory usage was never an issue so I didn't really focus on it specifically.

@pjasicek
Copy link
Owner

pjasicek commented Nov 7, 2018

image

Hehe this isn't good... this is after loading levels 1 through 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants