Anand Palaniswamy wrote:
> 
> Peter Schuller <[EMAIL PROTECTED]> writes:
> 
> > > The reason for this is that the default -Xmx value is 64MB.
> >
> > But that's the *maximum* heap size; why does JDK 2.0 consume, in one
> > particular case, 50 megs of RAM when JDK 1.1 consumed 15 megs, just
> > because the *maximum* heap size is higher? Does the JDK just ignore
> > freeing memory as long as it's under the max limit?
> 
> What ps/top report is the process size.  Not the working set.  If you
> had a tool that showed you the working set it should be lower than
> -Xmx (for most apps).

And if you had such a tool, it might look something like this little
script I hacked together a while back :-). It shows VM and RSS for all
of your processes, sorted in increasing order of RSS. You're welcome to
play with it and search for insights.

Nathan
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1999-03-06 15:06 PST by <[EMAIL PROTECTED]>.
# Source directory was `.'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    541 -rwxr-xr-x showmem
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh17924; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= showmem ==============
if test -f 'showmem' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'showmem' '(file already exists)'
else
  $echo 'x -' extracting 'showmem' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'showmem' &&
#!/bin/sh
X
echo 'Name                   PID          VM          RSS'
echo '----                   ---          --          ---'
(
cat /proc/*/status |
perl -n -e '
X    chop;
X    if (/^Name:/)
X    {
X       if ($name)
X       {
X           printf "%-20s %6d %-12s %-12s\n", $name, $pid, $vmsize, $vmrss;
X       }
X       s/.*\t//;
X       $name=$_;
X       $vmsize = "";
X       $vmrss = "";
X       $pid = "";
X    }
X    if (/^VmSize:/) { s/.*\t//; $vmsize=$_; }
X    if (/^VmRSS:/) { s/.*\t//; $vmrss=$_; }
X    if (/^Pid:/) { s/.*\t//; $pid=$_; }
'
) | sort -n +4 +2
SHAR_EOF
  $shar_touch -am 0805095598 'showmem' &&
  chmod 0755 'showmem' ||
  $echo 'restore of' 'showmem' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'showmem:' 'MD5 check failed'
3beb8aea99e80601541ce14f6d370da1  showmem
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'showmem'`"
    test 541 -eq "$shar_count" ||
    $echo 'showmem:' 'original size' '541,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh17924
exit 0

Reply via email to