>>>>> "MK" == Michelle Konzack <[email protected]> writes:
MK> Hello Stephen, MK> can you test the package please? MK> It can be found here: MK> <http://devel.debian.tamay-dogan.net/debian/pool/main/x/xmem/> MK> "apt-get install" is currently not available because I have to MK> reinstall the mirror and the scripts. MK> I have installed it on my machine and while running, loaded the MK> machine with 5 iceweasel instances, consumed memory up to swap, MK> closed the iceweasels and disabled the SWAP. MK> It seems to be working now. The binary runs without errors, but in my testing, the problem that the bug mentions still appears to exist. After you disable the swap, the desired behavior is that the graph should return to the scale where the full height of the window corresponds to the physical memory size (i.e., there should be no white space at the top of the window). Instead the behavior I see is the same as the old one: namely, if the swap has even been used, the display never reverts to the 1.0 scale. Part of the problem is that the way you're currently use the ceil function is a no-op: if give it an integer argument, it's just the identity function: scale = ceil((int) (w->mem_strip_chart.max_value)) + 1; Perhaps the following table will help explain the different possible kinds of rounding: x (int)x floor(x) floor(x)+1 ceil(x) ---- ------ -------- ---------- ------- 0.01 0 0 1 1 0.99 0 0 1 1 1.00 1 1 2 1 1.01 1 1 2 2 1.99 1 1 2 2 2.00 2 2 3 2 In the context of the xmem display, "x" here is the max_value: (1.0 + swap_usage)/(physical mem. size). The old behavior and the current behavior are equivalent to the second-to-last column, but I was suggesting ceil() to get the behavior in the last column. Because using ceil instead of floor/cast-to-int takes care of rounding up rather than down, you don't have to add 1. The only difference between the last two columns is when x is exactly an integer to start with, but that's the case that's important because max_value = 1.0 exactly when there's no swap. So the simplest version of the fix I was suggesting would just make that line: scale = ceil(w->mem_strip_chart.max_value); Note that that change would still leave the following related issues: * When swapping is enabled but not really needed, Linux will for some reason sometimes use a very small amount of swap. For instance in one test just now on my machine with 1.5GB of physical memory, when I enabled swapping and ran a program that used most of physical memory, Linux used 72KB of swap, making the max_value 1.000011. This is still so close to 1.0 that no swap would show up on the display, so one might want to not change the scale in this case. * Right now the code doesn't recompute the scale when larger values have scrolled off the left hand side, only when the window is exposed. This causes the behavior to differ depending on whether the window is ever temporarily obscured, which I think is undesirable. I think the plain StripChart used in xload (src/StripChart.c in libxaw), which the MemStripChart is a clone of, doesn't have this problem; comparing the code bases seems to indicate another inappropriate use of "(int)" (floor) rounding: StripChart.c MoveChart(): 481 if (old_max != w->strip_chart.max_value) { 482 XClearWindow(XtDisplay(w), XtWindow(w)); 483 repaint_window(w, 0, XtWidth(w)); 484 return; 485 } MemStripChart.c MoveChart(): 488 if ( ((int) old_max) != ( (int) w->mem_strip_chart.max_value) ) { 489 XClearWindow(XtDisplay(w), XtWindow(w)); 490 repaint_window(w, 0, (int) w->core.width); 491 return; 492 } The xmem code doesn't trigger a redraw when the max_value changes from (say) 1.5 to 1.0, but I think it should. -- Stephen -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

