Handling out of memory issues
Minix does not have virtual memory. This means all running programs must fit inside the amount of available RAM.
A program has, as part of its binary, a field which tells it how much memory to allocate for stack space when it starts up. If this amount is too much for the available free memory of the system then you will not be able to start it. If it is too little then the program may crash while running due to not having enough memory.
This field in the binary can be adjusted using a command called 'chmem'. As you get to know Minix more you'll get familiar with this command I suspect! To demonstrate the use of 'chmem' I'll show how to use it on the 'mined' command.
To find out how much memory the command requires (ie. the value in that field in the binary):
The most common occurance of this 'out of memory' issue is running X11. Running 'xdm' will often fail silently when you first try. This is due to 'Xorg' running out of memory:
You'll need to play around with the value to work out what exactly will work on your system depending on how much memory you have, and the configuration of your memory card.
Categories: minix, admin
A program has, as part of its binary, a field which tells it how much memory to allocate for stack space when it starts up. If this amount is too much for the available free memory of the system then you will not be able to start it. If it is too little then the program may crash while running due to not having enough memory.
This field in the binary can be adjusted using a command called 'chmem'. As you get to know Minix more you'll get familiar with this command I suspect! To demonstrate the use of 'chmem' I'll show how to use it on the 'mined' command.
To find out how much memory the command requires (ie. the value in that field in the binary):
# chmem +0 /usr/bin/minedThe value can be incremented using the '+' or decremented with '-'. It can be set to a specific value using '='. Setting it very low may result in the command being unable to run:
/usr/bin/mined: Stack+malloc area changed from 65536 to 65536 bytes.
# chmem =100 /usr/bin/minedIf you find a program crashes due to low memory try bumping up its chmem value using '+10000' at a time until it runs.
/usr/bin/mined: Stack+malloc area changed from 65536 to 100 bytes.
# mined
mined: Exec format error
# chmem =65536 /usr/bin/mined
/usr/bin/mined: Stack+malloc area changed from 100 to 65536 bytes.
# mined
...starts up...
The most common occurance of this 'out of memory' issue is running X11. Running 'xdm' will often fail silently when you first try. This is due to 'Xorg' running out of memory:
# chmem +0 /usr/X11R6/bin/XorgThis may not run depending on how much memory you have. By changing it to a lower value you can get X to run:
/usr/X11R6/bin/Xorg: Stack+malloc area changed from 520000000 to 520000000 bytes.
# chmem =50000000 /usr/X11R6/bin/Xorg
/usr/X11R6/bin/Xorg: Stack+malloc area changed from 520000000 to 50000000 bytes.
# startx
You'll need to play around with the value to work out what exactly will work on your system depending on how much memory you have, and the configuration of your memory card.
Categories: minix, admin

1 Comments:
Hi,
I don't understand why this is the only OS I know of that you must consistently fiddle with chmem to get anything worth while working ?
Could you please point me towards the correct files in the kernel snv trunk that explains the problems.
I would like to know what could be done to solve these problems and if I could maybe help with such a project.
background:I have written my own very basic RTOS for a microcontroller so have some basics I could build on I guess..
Regards,
EdwardOCallaghan.
Post a Comment
<< Home