Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: Dirty Exit.  (Read 13349 times)

torne

  • Bay Watcher
  • arf arf
    • View Profile
Re: Dirty Exit.
« Reply #15 on: June 10, 2009, 05:58:22 am »

Memory fragmentation is only really a problem within one process: if DF fragments its heap then it will use more memory than it strictly needs to but when you exit you will get all that back.

It is *almost* totally irrelevant whether the pages in physical ram are fragmented or not. Virtually nothing on a modern OS cares whether physical pages are contiguous.
Logged

smjjames

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #16 on: June 10, 2009, 06:58:15 am »

That could explain why there are millions of page faults listed for DF when I look at task manager. I don't have any problems with exiting DF. There is a pause and a moment when Vista lists it as not responding (it's actually working fine, just busy and Vista thinks its not working. Just one of Vista's quirks) when it saves, but understandable since I'm playing on a large map. Exiting the game itself works as it should.

Maybe run defragmenter or something.
Logged

torne

  • Bay Watcher
  • arf arf
    • View Profile
Re: Dirty Exit.
« Reply #17 on: June 10, 2009, 08:04:59 am »

Fragmentation of a program's heap is not something you can do anything about, unless you modify the program itself (and even then it can be very difficult to solve). Memory fragmentation is nothing to do with disk fragmentation. I have no idea if DF really suffers from this or not, btw.

Having a very high page fault rate suggests that DF's working set (the amount of memory it's dealing with at one time) is larger than the amount of physical ram your OS can spare for it: i.e. you don't have enough memory available for it to run without paging. This isn't necessarily a bad thing - OSes are pretty smart about paging (even Windows) and the performance overhead of doing a bit of paging around the edges of the working set is not large. Windows' statistics on this are also a bit vague and fluffy and have a tendency to count things that are irrelevant as well as useful data, so take it with a grain of salt. If you were finding that DF ran slowly but your CPU (or one of them, anyway) was *not* maxed out, then you might look into this as a source of performance problems.

The thing where DF sometimes shows up as Not Responding in task manager or similar is because it's busy doing some operation which doesn't include sufficiently frequent peeking at the win32 message system. You're supposed to pay attention to win32 messages within a reasonably short time, but in practise all that happens if you don't is spurious notifications that the app is not responding, and missed repaints (e.g. cover up and then uncover the DF window during worldgen and notice how long it takes to actually get around to redrawing it).

The OP's problem is "DF's large working set size has pushed other applications' memory out to disk and probably forced the disk cache to be reduced in size, and now everything you touch causes lots of pageins, plus it takes some time for the disk cache to let itself grow to its original size again". :)
Logged

smjjames

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #18 on: June 10, 2009, 08:19:43 am »

Fragmentation of a program's heap is not something you can do anything about, unless you modify the program itself (and even then it can be very difficult to solve). Memory fragmentation is nothing to do with disk fragmentation. I have no idea if DF really suffers from this or not, btw.

Having a very high page fault rate suggests that DF's working set (the amount of memory it's dealing with at one time) is larger than the amount of physical ram your OS can spare for it: i.e. you don't have enough memory available for it to run without paging. This isn't necessarily a bad thing - OSes are pretty smart about paging (even Windows) and the performance overhead of doing a bit of paging around the edges of the working set is not large. Windows' statistics on this are also a bit vague and fluffy and have a tendency to count things that are irrelevant as well as useful data, so take it with a grain of salt. If you were finding that DF ran slowly but your CPU (or one of them, anyway) was *not* maxed out, then you might look into this as a source of performance problems.

The thing where DF sometimes shows up as Not Responding in task manager or similar is because it's busy doing some operation which doesn't include sufficiently frequent peeking at the win32 message system. You're supposed to pay attention to win32 messages within a reasonably short time, but in practise all that happens if you don't is spurious notifications that the app is not responding, and missed repaints (e.g. cover up and then uncover the DF window during worldgen and notice how long it takes to actually get around to redrawing it).

The OP's problem is "DF's large working set size has pushed other applications' memory out to disk and probably forced the disk cache to be reduced in size, and now everything you touch causes lots of pageins, plus it takes some time for the disk cache to let itself grow to its original size again". :)

Actually, it's showing the not responding in the title bar, I don't need to look at task manager. I use task manager to 'crash' it when using the reveal utility since I don't want to actually have the tiles revealed when actually playing. I mainly use reveal to check the location of the magma pipe or whatever.

As for the worldgen window, when I'm genning large maps, it comes to a pause every several decades (it always stops at the same dates, such as 298) and acts like it's frozen and then after a minute or two, it resumes. When it's actually running, covering and uncovering it does not cause redrawing issues. When worldgenning a default world (medium worlds anyway), it doesn't have this problem

DF doesn't generally run slowly, although it will slow down to about 30-50 FPS when there is a high population, but that's just the FPS. When I pause, it jumps back up to around 100 FPS.

Actually, after playing for a long while, sometimes DF will suddendly slow down for no apparent reason as the FPS drops down to the 10s, 20s and does it even when paused. But a save, exit and reload fixes this.

How do I look at the win32 thing anyway? As for memory, I guess I could take a look and remove some stuff.
« Last Edit: June 10, 2009, 08:33:28 am by smjjames »
Logged

torne

  • Bay Watcher
  • arf arf
    • View Profile
Re: Dirty Exit.
« Reply #19 on: June 10, 2009, 10:58:50 am »

I think you misunderstood me, when I said "you're supposed to pay attention to win32 messages" I meant that application developers are supposed to code their applications to check the win32 message pump at a reasonable frequency - nothing to do with end users :)

There's a variety of reasons why FPS might temporarily drop, and they're unlikely to be anything to do with memory or windows resources, just the game's CPU usage.
Logged

smjjames

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #20 on: June 10, 2009, 11:18:46 am »

Yea,I thought you were talking about end users when you said that about the win32 thing.
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #21 on: June 11, 2009, 07:29:03 pm »

The OS could be precatching DF over other programs.
this means DF loads faster, and other programs don't load as fast as they could (using the precatching on those programs)

It should trigger most often for commonly used programs.
Logged

adasdad

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #22 on: November 21, 2010, 05:13:31 pm »

actually, df wont close for me period. (the "x" button wont work, but i can still use task manager.)
Logged
There are no words to describe my state of euphoria right now...
euphoric?

Nivim

  • Bay Watcher
  • Has the asylum forgotten? Are they still the same?
    • View Profile
Re: Dirty Exit.
« Reply #23 on: November 21, 2010, 05:21:35 pm »

This thread is more than a year old and doesn't apply to the current version.
Logged
Imagine a cool peice of sky-blue and milk-white marble about 3cm by 2cm and by 0.5cm, containing a tiny 2mm malacolite crystal. Now imagine the miles of metamorphic rock it's embedded in that no pick or chisel will ever touch. Then, imagine that those miles will melt back into their mantle long before any telescope even refracts an image of their planet. The watchers will be so excited to have that image too.

ToonyMan

  • Bay Watcher
  • Danger Magnet
    • View Profile
Re: Dirty Exit.
« Reply #24 on: November 21, 2010, 05:24:00 pm »

Hey I posted in this thread!
Logged

Fayrik

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #25 on: November 21, 2010, 08:35:29 pm »

I know this is a massive necro post, but I can't help but answer a question I think I can help with.  :-\

You say:
Quote
(the "x" button wont work, but i can still use task manager.)
Well, Dwarf Fortress actually disables the x button - although you can still press it, rather than close it will bring up the menu instead.
To close it, you really should save the game, or abandon the fort to close properly from the start screen.
Logged
So THIS is how migrations start.
"Hey, dude, there's this crazy bastard digging in the ground for stuff. Let's go watch."

doomdome

  • Bay Watcher
    • View Profile
Re: Dirty Exit.
« Reply #26 on: December 07, 2010, 09:26:18 pm »

I know this is a massive necro post, but I can't help but answer a question I think I can help with.  :-\

You say:
Quote
(the "x" button wont work, but i can still use task manager.)
Well, Dwarf Fortress actually disables the x button - although you can still press it, rather than close it will bring up the menu instead.
To close it, you really should save the game, or abandon the fort to close properly from the start screen.
Or end the process with task manager if you want to cheat and close without saving.
Logged
Pages: 1 [2]