Minix Miscellany
 
Open Source
Projects

 
TkZip
 
Woodsway Home
 

showmem

Display the stack + malloc memory allocation for a MINIX 3 program

showmem shows the current stack+malloc memory allocation for a program, without altering the program's modification timestamp; and it can be run by unprivileged users.

A MINIX binary executable has a fixed amount of memory alocated for malloc and stack space. From time to time it becomes necessary to increase this value (or desirable to decrease it) for certain programs. It is often useful to check a program's current memory size to determine how much it may need to be adjusted. So, how do you do that?

The traditional solution is to write a small script that does something like this:

chmem +0 [path_to_some_executable]

to which chmem will cheerfully respond with something like:

[path_to_some_executable]: Stack+malloc area changed from 16384 to 16384 bytes.

Fine, that tells you what you wanted to know. So what's wrong with that?


A couple of things, really. chmem actually does rewrite the executable, even though the value is not changed. This means that

  1. You can't use it unless you are running as root or bin (and you do normally login as an unprivileged user, right?)
  2. If you have any programs that are sensitive to changed modification timestamps (like an intrusion detection system, or - ahem - build scripts that may be run by binpackage ) , you may cause them to make false assumptions by using chmem .

showmem does not have these limitations. It only reads the file, and can be run by any user. It was originally written because I needed something like it to use in the build script for my FVWM port .


This package has been tested under both MINIX 3.1.2a and 3.1.3a

Instructions:

  1. Download the package here, read the README.minix file, then run the build.minix script. The binary will be installed in /usr/local/bin ; the man page will be installed in /usr/local/man/man1 .

Download showmem-1.0.0.tar.bz2 (6894 bytes)

(The core of the program, of course, is cheerfully stolen from Andy Tanenbaum's chmem . Any new bugs, however, are my own original work!)


Woodsway Consulting, Inc.     1 Queen's Court, Danbury, CT   06811
  minixguy@woodsway.com           203.791-2315 tel   203.240.5525 cell