[svlug] Debugging memory problems

Sanatan Rai sanat at stanford.edu
Tue Jan 15 23:57:02 PST 2002


Gentlemen,
	Thank you very much for your suggestions. This gives me something
to chew on.

	I use g++ exclusively, and the non-ANSI stuff that I use is mostly
stuff like

	const int nyears = hiyear - loyear + 1 ;
	long  pop[nyears] ;

etc...

	I am not smart enough to use anything that is machine or locale
specific.

	The files I use are either read once or written to once. They are
all text files.

	How do I track how much memory the programme used before it
crashes? It crashes too soon for me to run top/ps. Is there some library I
can link or some programme whose aegis the sim can run under and which
will give me the info?

	As an aside, compilation on HP-9000 bangs. I have appended the
errors below, a bit surprising I thought.

	The 32MB limit for x86 seems to be a tempting explanation...

	Long live SUN.

	Again, thanks a lot!

--Sanatan

amy1:~/src/bcsim $ uname -as
HP-UX amy1 B.11.00 C 9000/780 2008969857 32-user license
amy1:~/src/bcsim $ cons .
g++ -O -Iinclude -c sim/adjust2.c -o sim/adjust2.o
g++ -O -Iinclude -c sim/util.c -o sim/util.o

In file included from sim/util.c:2:
/usr/pubsw/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:29:
warning: declaration of `int memcmp(const void *, const void *, long
unsigned int)'

/usr/pubsw/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:29:
warning: conflicts with built-in declaration `int memcmp(const void *,
const void *, unsigned int)'

/usr/pubsw/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:85:
warning: declaration of `void * memcpy(void *, const void *, long unsigned
int)'

/usr/pubsw/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:85:
warning: conflicts with built-in declaration `void * memcpy(void *, const
void *, unsigned int)'

/usr/pubsw/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:93:
warning: declaration of `size_t strlen(const char *)'

/usr/pubsw/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:93:
warning: conflicts with built-in declaration `unsigned int strlen(const
char *)'

Install prng/libprng.a as lib/libprng.a
g++ -O -o sim/adjust sim/adjust2.o sim/util.o -Llib -lprng


And one  `You forgot also to put the right library in the right place'
message.

-- 
Sanatan Rai,                      | E.-mail: sanat at stanford.edu
Dept. of Management Sc. & Engg.   | Home: 100 N. Whisman Road 4316,
Stanford University,              |       Mountain View, Ca 94043.
Stanford, Ca 94305.               | 'phone: (650) 964 0220 (R)
EMail: sanat at stanford.edu                   (650) 736 2109 (O)





More information about the svlug mailing list