roger@zuken.co.jp (Roger Meunier) (08/08/90)
A few weeks ago, I got my hands on Conor P. Cahill's (uunet!virtech!cpcahil) malloc/string debugging library. I linked it with one of my Motif-based test applications to check for memory leaks, etc. in *my* code but ran into problems with the Motif library first. The memory-leak issue has been dealt with before, so I won't rehash it here. What concerns me is that the *bugs* I encountered could have been easily caught if someone testing Motif *before* letting it out into the real world would have done the simple tests which Mr. Cahill's library allows. For example: 1) Accessing free()'d memory. I hope this one is fixed in the next release. It occurred with my application and also with xmdialogs (from xmsamplers). Destroying any widget that contains a command, file selection box/dialog, or selection box/dialog and then returning to the event loop results in sombody trying to access the XmScrollBar widget *after* it has been deallocated. (Mr. Cahill's tool fills deallocated memory with a pattern which causes most applications to choke if they try to access it again. Motif choked at _XmAtomtoName+0x12a.) 2) Overrunning the end of an allocated buffer. I tried copying a string between XmText widgets using the secondary buffer. Motif apparently does a realloc() on some internal buffer, at which time it was discovered that someone had written 6 bytes into the buffer when only 5 were allocated. (On my machine, this didn't cause the program to crash, but I do remember a few months ago when my program *did* crash when I used this feature, but at that time I blamed it on my own coding. Who knows what else is lurking here...) Seeing as there are tools available which catch these sort of problems, I can only hope that they become widely used in the future. When trying to shake bugs out of my own code, it would be nice if I didn't have to hassle with someone elses... now who wants to argue with THAT? (I am using Motif 1.0 with X11R3 on HP9000 300-series under HP-UX 7.0.) -- Roger Meunier @ Zuken, Inc. Yokohama, Japan (roger@zuken.co.jp)
roger@zuken.co.jp (Roger Meunier) (08/09/90)
In article <ROGER.90Aug7152600@rd11.zuken.co.jp> I wrote: >A few weeks ago, I got my hands on Conor P. Cahill's (uunet!virtech!cpcahil) >malloc/string debugging library. Wow! I didn't realize that such a library was in such demand! I'm getting swamped with e-mail asking how to get a hold of the library, so I'll post my reply and then try to answer my mail. I found the shar'ed source (somewhere) on the net several weeks back (the post has since expired on our system :-( ). I don't know if it's available by ftp; please contact Mr. Cahill at uunet!virtech!cpcahil for details of how to get his library. If someone finds out, please let me or the net know. (Now, if Mr. Cahill *himself* reads this, I'm sure he will set things straight...) -- Roger Meunier @ Zuken, Inc. Yokohama, Japan (roger@zuken.co.jp)