On Thu, May 10, 2001 at 07:22:13AM -0400, Uncle George wrote:
> Malloc/free bugs are never that simple.  Generally u are freeing up the (same)
> pointer for a second time, or u stepped over the allocation size and onto a malloc
> header. How do u know which one,  by eliminating the possibility of freeing the
> same pointer twice ( which for me has been to print out all the ptr's given & put
> back by the malloc routines )
> /gat
> 

I agree to Rick, they are 'quite' easy ...
For two reasons: first it is rather well defined
which function calls are involved and second there are so
many utilities waiting for you to be used for that
purpose.
It took me a few seconds to produce the following printout.
Note that I mentioned this fine tool some weeks ago on some
of our lists here. And back to the discussion: if you
get some other strange problems within LessTif like
something never shwoing up or major visual problems
there is no tool which will help you. I guess that's
what Rick meant.

BTW, I haven't checked yet whether this info is really 
sufficient to cure the bug; if you read lesstif-commits
and don't see an entry within the next minutes it wasn't
enough for now ;-)


.--------------------------------------------------------------------------.
|================ ccmalloc-0.3.4 (C) 1997-2000 Armin Biere ================|
+--------------------------------------------------------------------------+
| executable       = test1                                                 |
| startup file     = .ccmalloc                                             |
| log file         = Log                                                   |
| start time       = Thu May 10 13:33:03 2001                              |
| operating system = Linux 2.0.36 i586                                     |
+--------------------------------------------------------------------------+
| only-count        = 0            keep-deallocated-data = 1               |
| check-interval    = 0            check-free-space      = 0               |
| check-start       = 0            file-info             = 1               |
| chain-length      = 0            additional-line       = 1               |
| check-underwrites = 0            print-addresses       = 0               |
| check-overwrites  = 0            print-on-one-line     = 0               |
| sort-by-wasted    = 1            sort-by-size          = 1               |
| # only-log-chain  = 0            continue              = 0               |
| # dont-log-chain  = 0            statistics            = 0               |
| debug             = 1            library-chains        = 0               |
| load-dynlibs      = 1            align-8-byte          = 0               |
| only-wasting-alloc= 1                                                    |
`--------------------------------------------------------------------------'
*** free() called twice for block at 0x08645af0 of size 256
*** it was allocated at
***   |
***   |     0x08049df5 in <main>
***   |                at
/home/mai/compile/lesstif/lesstif/lib/Xlt/tests/FontChooser/test1.c:26
***   |
***   |     0x40223464 in <XtRealizeWidget>
***   |
***   |     0x40223375 in <RealizeWidget>
***   |
***   |     0x402231bb in <RealizeWidget>
***   |
***   |     0x4003778a in <Realize>
***   |                at
/home/mai/compile/lesstif/lesstif/lib/Xlt/lib/FontChooser.c:370
***   |
***   |     0x402108a3 in <XtMalloc>
***   |
***   `---> 0x08053fa2 in <malloc>
***                    at src/wrapper.c:284
***    
*** and already freed at
***   |
***   |     0x08049df5 in <main>
***   |                at
/home/mai/compile/lesstif/lesstif/lib/Xlt/tests/FontChooser/test1.c:26
***   |
***   |     0x40223464 in <XtRealizeWidget>
***   |
***   |     0x40223375 in <RealizeWidget>
***   |
***   |     0x402231bb in <RealizeWidget>
***   |
***   |     0x400379e8 in <Realize>
***   |                at
/home/mai/compile/lesstif/lesstif/lib/Xlt/lib/FontChooser.c:421


-- 
Alexander Mai
[EMAIL PROTECTED]

Reply via email to