Stuttering, garbage collection and Memory usage

Discussion in 'PlanetSide 2 Gameplay Discussion' started by placeholder22, Dec 8, 2018 at 3:04 AM.

  1. placeholder22

    So PS2 runs like ***, and not just in the big fights. I've identified a memory issue and I'm not sure if it is specific to the VM setup, to windows, or to something PS2 does.

    I'm running a VM windows 7 home premium guest on 3 cores of a i7 6700K 4ghz with an old GF660 card on vfio passthrough on a linux host. Yes, this is a rather peculiar setup, and it took quite a bit of experimentation to get it to even borderline playable.

    Here's a thing I noticed though: Performance starts out ~100fps at the warpgate, and goes down the gutter as soon as memory usage reaches 50% total according to the windows task monitor (shift-ctrl-escape) what does this look like? Well, I can give the VM 6 gb of ram or 8gb or even 12 gb. In either case, before starting PS2 it'll use like 1.5gb of ram (for windows itself) and as I run PS2 the memory will fill up until it reaches half the total. That means, it'll run up to 3gb total usage if I set the memory to 6gb total, and then the game starts stuttering and not really increasing its memory footprint anymore. If I set it to 8, 10, 12gb ram usage (I have 16gb physical memory) it'll take a minute or two to fill up to 50% usage and start stuttering.

    What is the stuttering like? It feels like 10fps but it displays as 40 fps. so, being a programmer myself, I can immediately tell what is happening: PS2 is streaming in data constantly, causing the memory footprint to increase. Until at 50% total ram usage (for some reason) the garbage collection kicks in and tries to free up "unused" memory to go below 50% again. And this GC process is so slow it makes single frames take like 100ms. It only happens every few frames, making the game feel like its 10fps while displaying 40fps.

    And adding more RAM to the VM doesn't work, all that does is delay the point at which the 50% ram usage mark is reached somewhat and the stuttering begins. What kinda might work as a workaround might be to just add additional pre-rendered frames, triple buffering, such things, which cause additional input lag. They don't fix the underlying problem. So how do I fix the underlying problem of the garbage collector messing up everything? You simply can't have a GC delaying frames like that, that's crappy programming. If anything you have the GC in a separate, non-blocking thread! And how do I convince PS2/Win7 to actually use 100% of my ram, instead of only working to the half of it? This might be some windows setting that I'm unaware of.
  2. placeholder22

    I also found that alt-tabbing out of the game, then back into the game, for a few seconds gives me a massive fps and smoothness boost. Then it goes right back to running like total ****. So I am pretty confident that there's a bunch of coders who need a good strangling, because that is some massive **** up.
  3. DeadlyOmen

    The internet: where it is always someone else's fault, and someone professing to be an expert can't solve their own problem.
  4. placeholder22

    ... and there's never a shortage of unhelpful comments by people who just want to increase their post counts.

    Turns out I had to clean out the physical gunk out of the cooler of my gfx card. Because the linux driver was no longer attached to the card, I didn't get any warnings about it overheating and thus throttling. Of course the windows drivers don't do any such thing by themselves, when I got suspicious, I had to install a secondary tool. Why is everything so needlessly complicated on windows?? Not sure how a card that ran games fine in Linux would overheat on potato settings in windows, but alas.
    • Up x 1
  5. Inogine

    I mean... Considering I have played for many hours straight without a memory leak like you, alt-tabbing and all... Might be the fact that it's a VM? Emulating things tends to always be a tricky proposition that I've still yet to see anyone do properly without oddities. I'd guess your problems are more than likely stemming from that rather than the game.
  6. Rydenan

    The performance of the game definitely does degrade over time. One of the most noticeable things for me is the delay between de-cloaking and when you can fire. It's something like 1/4 of a second by default, but if I have the game open for 2-3 hrs, (other than re-evaluating what I'm doing with my life) I notice that the delay increases to a second or more. This makes playing infil basically suicide, and necessitates a client restart. Restarting also usually improves framerate.
    VM != emulation.
    This company runs high-end games on high-end hardware, all inside of Win10 VMs running on Linux hosts.
  7. JibbaJabba

    I had to troubleshoot my own perf issue a few months back. Ran a perfmon data collector set. I found the initial memory footprint is about 1/2 of it's stabilized total. It will grow from this over about the course of an hour as new areas and continents are visited then plateau.

    The game itself doesn't seem to have a resource leak that I can tell. But it's not brilliant about dumping assets from cache. As a result it leans heavily on Windows to just juggle the memory demand.

    If you give it a touch too little physical memory, it sends windows into garbage collection thrashing. Windows provides all the requested memory, but it spends a lot of CPU cycles to do so. (freeing memory is surprisingly expensive and is done during "idle" time)

    I had several non-Planetside issues consuming resources here and there that needed cleaned up. Likely not applicable to you but the general idea is the same.

    I really think you may need to throw some physical ram at it and just haven't yet thrown enough. A 16GB physical system works fine. an 8GB does not. There may be a more nuanced number but that's what I've seen myself.
  8. strikearrow

    It's a friggin 6-year-old game so it shouldn't require a high performance rig to handle it. A 6-year-old (high performance at the time) rig should be able to handle this game with maximum graphics and the like. Either the game is very poorly coded or new rigs are just trash.

Share This Page