Ibrahim Haddad wrote:
> Sometimes when I run my program (C+Motif+Xlib), it hangs out, the system
> freezes and all of my 20MB physical RAM and the 32 MB swap space get full
Then you've probably got a memory leak. Xt programs are prone to
memory leaks, and Motif programs even more so (due to the need to
construct XmString objects).
Remember that most of the items returned by Xt[Va]GetValues need to be
freed explicitly. Also, the data passed to Xt[Va]SetValues is usually
copied, so you can free the original afterwards. Also, If you create
an XmString from a String (i.e. `char *'), you can free the original
String if you no longer need it.
> and the only way to stop this is to either turn off/on the system or
> use the Reset bottom (Ctrl+Alt+Del wouldn't work).
If you have more swap than RAM, and you exhaust virtual memory, then
the system will become extremely slow. Ctrl-Alt-Del might work, but it
might take several minutes before init actually starts to shut down
the system.
If you're testing a program which tends to leak memory, it's probably
a good idea to use e.g.
ulimit -v 16000
in the shell from which you run the program (assuming it's a Bourne
shell, e.g. bash). This will limit the program's VM usage to 16Mb.
> 2 days ago, I re-installed a newer linux version (slakware 3.4 kernel 2.0.30)
> and on boot I get the following message:
> (date & time of boot) modprobe: Can't locate module char-major-10-135
Character device 10.135 is /dev/rtc (the hardware clock). It's only
enabled if you define CONFIG_RTC when building the kernel. This is
unlikely to be related to your problems.
> Could it be that my program freezes the system because of some memory
> leak or it has something to do with installing a newer kernel?
Exhausting memory on any system with a lot of swap will case the
system to (almost) freeze.
> PS: The problem appeared when I installed the new kernel.
It may be the case that for some reason the new kernel is more
sensitive to running out of memory, or it may just be coincidence.
--
Glynn Clements <[EMAIL PROTECTED]>