Should my swap size be zero or am I misunderstanding the output?

53

As long as there is free memory available, the system will never use swap. In fact, swapping should be avoided in a system as possible...

On the other hand, in your case, it seems that you don't have a swap partition. Otherwise you should see something like this:

$ swapon -s 
Filename                Type        Size    Used    Priority
/dev/sdb1                               partition   1952764 0   -1
Share:
53

Related videos on Youtube

Eric
Author by

Eric

Updated on September 18, 2022

Comments

  • Eric
    Eric over 1 year

    I added an UndoManager to a JTextPane in my application, but I can't get it work:

    UndoManager undoManager = new UndoManager();
    textpane.getDocument().addUndoableEditListener(undoManager);
    

    When I manually type into the text pane, then try to undo the changes, nothing ever happens undoManager.canUndo() always returns false.

    I also tried another way of adding the manager as follows:

    textpane.getDocument().addUndoableEditListener(new UndoableEditListener()
    {
        @Override
        public void undoableEditHappened( UndoableEditEvent e )
        {
            System.out.println("UndoableEditEvent");
            undoMgr.addEdit(e.getEdit());
        }
    });
    

    With the above code I can see in the output window that the undoableEditHappened( UndoableEditEvent e ) is called once at the start (most likely by a read call which loads the test file). When I make changes (via keyword) or insertText(...) calls, there are no further listener calls.

    I found some similar questions here in StackOverflow, but the solutions were always alongs the lines that they had custom input methods for the JTextPane, I don't ... not that I know of.

    What might I have overlooked?

    • camickr
      camickr over 3 years
      Read the section from the Swing tutorial on Text Component Features for a working example. The tutorial also has a section on Implement Undo and Redo.
  • Daniel Lopez
    Daniel Lopez almost 9 years
    Try sudo fdisk -l to see your partitions
  • Phil
    Phil almost 9 years
    This results in: Device Boot Start End Blocks Id System /dev/xvda1 * 16065 16771859 8377897+ 83 Linux so this indicates no swap partition. Thank you for clearing that up.