Memory access error in XWin -multiwindow

Harold L Hunt II huntharo@msu.edu
Mon Jul 7 03:02:00 GMT 2003


Both of these approaches look interesting.

Thanks Biju and Ralf.

Harold

Ralf Habacker wrote:

> Hi Biju,
> 
> 
>>I am facing an issue of Memory access error in XWin -multiwindow mode
>>see http://www.cygwin.com/ml/cygwin-xfree/2003-06/msg00294.html
>>
>>So Ralf pointed me to http://cygwin.com/ml/cygwin-xfree/2003-06/msg00162.html
>>
>>After seeing that patch, I have just gone thru XWin Source and found,
>>at lot of place we call memory alloc and not testing the return value.
>>I am attaching the list & extracts from programs
>>I dont know all of those will make any issue.
>>
>>I did not checked whether it is properly "free()"-ed
> 
> 
> You can try the mem_watch library on
> http://sourceforge.net/project/showfiles.php?group_id=27249.
> It allows checking of memory related calls on cygwin with minimal effort.
> 
> After installing this package, relink the Xserver with the following line:
> 
> $ make LDFLAGS="-Wl,--whole-archive -Wl,-lmemwatch -Wl,--no-whole-archive"
> 
> Then start Xwin and you can see all memory related calls and there calling
> address.
> 
> See an example output below (you can get more informations through the INSTALL
> file of the memwatch release).
> 
> $ ./test
> MemWatch hooks installed (set MEMWATCH=1 env var to enable debugging)
> 
> Memory Checker report
> =====================
> number of calls:
>         malloc       : 3
>         calloc       : 1
>         realloc      : 0
>         free         : 1
> 
>         used memory  : 350
> 
> unfree'd memory areas
> 
>   address     size    calladdr
> 
>  0a040488      300    00401afc
>  0a040448       20    00401ac7
>  0a040460       30    00401ad9
> ==============================
>                350
> 
> compile this application with debugging symbols and try
> addr2line to get the source line of the relating call
> 
>         addr2line -e ./test.exe <calladdr>
> 
> May be that helps.
> 
> Cheers
> Ralf



More information about the Cygwin-xfree mailing list