FORUM ARCHIVED

Linux 64-bit Each save load increasing resident memory usage by ~64MiB

Discussion in 'Bugs' started by Tieren, Dec 18, 2012.

  1. Tieren

    Tieren Member

    After launching Dredmor-amd64 and loading a saved game, Dredmor is consuming roughly 439MiB memory.

    If I blow myself up with a few runes of exploding, return to the load screen, and load the same save it's using 503.

    Repeating: 439 -> 503 -> 570 -> 635 -> 700 -> 763 -> got bored and stopped. I've managed to run my system out of memory a couple times after leaving Dredmor up and doing some very stupid things in it for fun.

    On each load, I can see some of the flames (and actually some damage numbers, though my health doesn't drop) still on screen from the previous load's explosions. It feels like it's not actually clearing the game world prior to loading the save and just leaving it hanging out in memory.

    If this is a known issue, my apologies. I tried hunting around (briefly) and did see a post from 2011 indicating that there was potentially some form of memory issue, but it wasn't clear if it was related.

    If this is not a known issue (or hey, even if it is), is there any additional information I can provide to help out?
     
    OmniaNigrum likes this.
  2. OmniaNigrum

    OmniaNigrum Member

    This does sound like a undeniable memory leak.

    Sadly I do all my gaming on the Windows side and cannot check for myself if this happens. I would gladly load up Linux Mint to see how it runs for me, but GPU drivers drive me insane due to AMD and Nvidia never having up to date and working drivers for Linux. (Not even the closed source precompiled garbage they did years ago. They basically just abandoned Linux.)

    You were right to report this. Details on how it works are essential to figuring out what went wrong and what can be done to fix it. Could you provide some hardware background besides the fact that you use an AMD CPU and 64 bit Linux OS? What distro? What GPU? What CPU? (Specifically.) And finally how much RAM and what size swap partition you use, as well as anything you think may help? (I presume you use Top, so you can tell us how much memory you have used and free before you run the game too.)

    I for one will keep watching the thread. And see if I can find a way to limit or negate this problem on my side. (After I find a way to get Mint working well enough to bother on my GPU.)
     
    Tieren likes this.
  3. Tieren

    Tieren Member

    Can do. I'll compile some system / usage info and see if I can't test 32-bit as well when I get home.
     
    OmniaNigrum likes this.
  4. Tieren

    Tieren Member

    Well.
    ...
    That was interesting.
    ...
    For a reasonably accurate representation of the new testing character Sgt Angel introduced once I started testing 32-bit, and its conversation with Steam's API over Steam deleting all of my saved games (RIP 2012! Ah well, losing is fun ;)):


    Anyways. System info in a big brick at the bottom. For memory use I found something interesting, maybe. The amount of memory used each iteration does seem to be related to the size (depth? complexity? progress_in_game) of the save file involved.

    Here's what happened loading Dredmor-amd64 with my level 14-ish golem-pyro-tinkerer-thing at the end of floor 5 or so, probably... 7 wizard lands completed, I think.

    No game:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    617808    7554476          0      1968      52476
    -/+ buffers/cache:    563364    7608920
    Swap:      4192960          0    4192960
    
    Game loaded to main screen (not launcher):
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    878204    7294080          0      6244    139168
    -/+ buffers/cache:    732792    7439492
    Swap:      4192960          0    4192960
    
    After game load:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    1176344    6995940          0      7476    166428
    -/+ buffers/cache:    1002440    7169844
    Swap:      4192960          0    4192960
    
    Blow self up, memory after game re-load:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    1246048    6926236          0      7536    169012
    -/+ buffers/cache:    1069500    7102784
    Swap:      4192960          0    4192960
    
    Loaded up steam (linux beta, not running this through wine or anything), steam silently nuked my saves, loaded game for 32-bit testing with Sgt Angel the level 1 suicidal golemancer and 6 other skillsets that provide mana/sagacity/savvy at level 1. Using blade being as mode of death, since it's available with zero dungeon exploration.

    No Game, but steam loaded:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    1763104    6409180          0      22564    904300
    -/+ buffers/cache:    836240    7336044
    Swap:      4192960          0    4192960
    
    Game loaded:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    1972704    6199580          0      22644    913432
    -/+ buffers/cache:    1036628    7135656
    Swap:      4192960          0    4192960
    
    Loaded new character, set up some blades, saved:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    2041516    6130768          0      22660    913852
    -/+ buffers/cache:    1105004    7067280
    Swap:      4192960          0    4192960
    
    Re-loaded after slicity death:
    Code:
                total      used      free    shared    buffers    cached
    Mem:      8172284    2053048    6119236          0      22684    914256
    -/+ buffers/cache:    1116108    7056176
    Swap:      4192960          0    4192960
    
    Accidentally obtain Normandy achievement. Go me. :D

    After noting that suddenly the game is only gaining about ~10MiB/load instead of ~64, I loaded up Sgt Angel in the amd64 release again and tested (this time with htop resident memory numbers, since it just follows the 32-bit pattern per load):
    Save loaded: 243M -> Reload: 251M -> Reload: 262M -> Reload: 274M -> Reload: 285M

    So still seems leaky, but oh so much less leaky than a character with any progress.

    Now, system information! I'm running Gentoo, and using Gentoo sources for kernel 3.6.6. I can provide my kernel's config.gz if it's relevant, but largely all I've done with this kernel is rip out hardware support for hardware I don't have.

    8 GiB RAM, all DIMMs are matching latency, etc. 4 GiB swap. I've got kernel swappiness set to 0 because I don't use more than ~80% of my RAM unless something I'm doing goes horribly wrong. Doubt swappiness matters, but full disclosure of abnormal settings from the start, right?

    CPU Governor for all cores is set to conservative.

    Desktop UI - Compiz as a window manager, tint2 as a taskbar, alt+f2 launches gmrun. No desktop environment or other pieces currently.

    obligatory uname -a:
    Linux fenrir 3.6.6-gentoo #1 SMP PREEMPT Fri Nov 23 20:03:00 CST 2012 x86_64 AMD Phenom(tm) II X4 965 Processor AuthenticAMD GNU/Linux

    CPU (using lshw, /proc/cpuinfo is literally 4 repeating blocks, one per core, of the same information. microcode is 0x1000086):
    Code:
        *-cpu
              description: CPU
              product: AMD Phenom(tm) II X4 965 Processor
              vendor: Hynix Semiconductor (Hyundai Electronics)
              physical id: 4
              bus info: cpu@0
              version: AMD Phenom(tm) II X4 965 Processor
              serial: To Be Filled By O.E.M.
              slot: AM3
              size: 800MHz
              capacity: 3400MHz
              width: 64 bits
              clock: 200MHz
              capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt hw_pstate npt lbrv svm_lock nrip_save cpufreq
              configuration: cores=4 enabledcores=4
            *-cache:0
                description: L1 cache
                physical id: 5
                slot: L1-Cache
                size: 512KiB
                capacity: 512KiB
                capabilities: pipeline-burst internal varies data
            *-cache:1
                description: L2 cache
                physical id: 6
                slot: L2-Cache
                size: 2MiB
                capacity: 2MiB
                capabilities: pipeline-burst internal varies unified
            *-cache:2
                description: L3 cache
                physical id: 7
                slot: L3-Cache
                size: 6MiB
                capacity: 6MiB
                capabilities: pipeline-burst internal varies unified
    
    GPU (using nvidia binary compiled against kernel, version is 310.19) via lspci -v:
    Code:
    01:00.0 VGA compatible controller: NVIDIA Corporation GF114 [GeForce GTX 560 Ti] (rev a1) (prog-if 00 [VGA controller])
    Subsystem: eVga.com. Corp. Device 1567
    Flags: bus master, fast devsel, latency 0, IRQ 18
    Memory at f8000000 (32-bit, non-prefetchable) [size=32M]
    Memory at d8000000 (64-bit, prefetchable) [size=128M]
    Memory at d4000000 (64-bit, prefetchable) [size=64M]
    I/O ports at dc00 [size=128]
    [virtual] Expansion ROM at fbe80000 [disabled] [size=512K]
    Capabilities: [60] Power Management version 3
    Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [78] Express Endpoint, MSI 00
    Capabilities: [b4] Vendor Specific Information: Len=14 <?>
    Capabilities: [100] Virtual Channel
    Capabilities: [128] Power Budgeting <?>
    Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
    Kernel driver in use: nvidia
    Kernel modules: nvidia
    
     
    mining and OmniaNigrum like this.
  5. OmniaNigrum

    OmniaNigrum Member

    I wish I could click like a dozen times for this. You gave an abundance of useful data! (Nice system hardware and great OS config too BTW.)
     
  6. mining

    mining Member

    /bow
     
    OmniaNigrum likes this.
  7. Daynab

    Daynab Community Moderator Staff Member

    Hey, thanks for all the info, I'll poke a dev about it.
     
    OmniaNigrum likes this.
  8. Tieren

    Tieren Member

    Glad to attempt to assist, everyone.

    I've got this thread notifying me by email, so if more information is needed or someone wants me to try something, lemme know. :D
     
    OmniaNigrum likes this.