Memoryleak detection using MALLOCDEBUG


 
Thread Tools Search this Thread
Operating Systems AIX Memoryleak detection using MALLOCDEBUG
# 1  
Old 03-30-2008
Memoryleak detection using MALLOCDEBUG

This topic could also fit into the High Level Programming Forum, but i post it here since its very AIX specific.
I am trying to isolate and resolve memory leaks and -corruption using AIX's MALLOCDEBUG environment variables.
Isolate and resolve memory leaks using MALLOCDEBUG on AIX Version 5.3

This works fine when using a small test application. But when using it with with our more complex application it crashes with signal 4 when starting up and no error message is printed to the mallocdebug logfile.

I wonder if anyone has been using this feature with a 'real' application with success.

And i wonder if there are any alternatives for searching memory leaks / memory corruption within a c programm.

- AIX MALLOCDEBUG
- Purify (only works with a specifig gcc version)
- ZeroFault (commercial didnt try it yet)
- libraries like EFence (needs recompilation of the complete source (which sucks))
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Curl detection of redirect

This URL: Internet Archive Wayback Machine ..will redirect to this URL when using a browser: https://web.archive.org/web/20140110200053/http://rapor.tuik.gov.tr/reports/rwservlet?adnksdb2&ENVID=adnksdb2Env&report=wa_idari_yapi_10sonrasi.RDF&p_il1=17&p_yil=2012&p_dil=2&desformat=html But... (0 Replies)
Discussion started by: Mid Ocean
0 Replies

2. Programming

Parallel Processing Detection and Program Return Value Detection

Hey, for the purpose of a research project I need to know if a specific type of parallel processing is being utilized by any user-run programs. Is there a way to detect whether a program either returns a value to another program at the end of execution, or just utilizes any form of parallel... (4 Replies)
Discussion started by: azar.zorn
4 Replies

3. AIX

NFS mount detection

Hi, I have a handy script in Linux, part of which checks for the presence of nfs mounts, using the information in /proc/mounts. Is there a suitable command or file in AIX that could be used in a similar way? Many thanks in advance (1 Reply)
Discussion started by: SDG
1 Replies

4. Shell Programming and Scripting

NAT detection

hellou, can anybody help me with nat detection in real time ? i prefer some detection script because i try some nat detection program's for example p0f or i'm using tcpdump, but i would get contain of specific packet. Some ideas? (1 Reply)
Discussion started by: TheTechnic
1 Replies

5. Shell Programming and Scripting

key detection in a script

Heloo every one I want to write a script that detects a key press and mouse click and movement,but I dont know how. The second one is I want to run myscript without writing the shell ie not "sh script.sh" but "script.sh" Can you help me out of here? Thanks in advance. (9 Replies)
Discussion started by: enoch99
9 Replies

6. Shell Programming and Scripting

begin end detection

Hi all, i am new to scripting. i need to write a code to detect begin and end of word that either begins or ends with t,th,d,dh,s,sh i have a set of words in a file containg one word per line. let the filename be aaa.txt. i have an another file bbb.txt which has two lines, just specifying the... (7 Replies)
Discussion started by: blkanth
7 Replies

7. IP Networking

modem detection

How to get information that where is my modem configured in /dev. I have two modems configured in my device .. one is USB and other is PCI modem.. USB is detected as /dev/USB0. but how to see about PCI modem? (0 Replies)
Discussion started by: s123.radha
0 Replies

8. UNIX for Dummies Questions & Answers

virus detection

IS there virus software for unix? I worked in a Solaris environment and dont remember having anything. I also ask because the current enviroment i am working on is Microsoft and they argue that they do not use unix because of virus detection. Any input would be greatly appreciated. (1 Reply)
Discussion started by: pbonilla
1 Replies
Login or Register to Ask a Question
TCL_MEM_DEBUG(3)					      Tcl Library Procedures						  TCL_MEM_DEBUG(3)

__________________________________________________________________________________________________________________________________________________

NAME
TCL_MEM_DEBUG - Compile-time flag to enable Tcl memory debugging. DESCRIPTION
When Tcl is compiled with TCL_MEM_DEBUG defined, a powerful set of memory debugging aids are included in the compiled binary. This includes C and Tcl functions which can aid with debugging memory leaks, memory allocation overruns, and other memory related errors. ENABLING MEMORY DEBUGGING
To enable memory debugging, Tcl should be recompiled from scratch with TCL_MEM_DEBUG defined. This will also compile in a non-stub version of Tcl_InitMemory to add the memory command to Tcl. TCL_MEM_DEBUG must be either left defined for all modules or undefined for all modules that are going to be linked together. If they are not, link errors will occur, with either TclDbCkfree and Tcl_DbCkalloc or Tcl_Ckalloc and Tcl_Ckfree being undefined. Once memory debugging support has been compiled into Tcl, the C functions Tcl_ValidateAllMemory, and Tcl_DumpActiveMemory, and the Tcl mem- ory command can be used to validate and examine memory usage. GUARD ZONES
When memory debugging is enabled, whenever a call to ckalloc is made, slightly more memory than requested is allocated so the memory debug- ging code can keep track of the allocated memory, and eight-byte ``guard zones'' are placed in front of and behind the space that will be returned to the caller. (The sizes of the guard zones are defined by the C #define LOW_GUARD_SIZE and #define HIGH_GUARD_SIZE in the file generic/tclCkalloc.c -- it can be extended if you suspect large overwrite problems, at some cost in performance.) A known pattern is writ- ten into the guard zones and, on a call to ckfree, the guard zones of the space being freed are checked to see if either zone has been mod- ified in any way. If one has been, the guard bytes and their new contents are identified, and a ``low guard failed'' or ``high guard failed'' message is issued. The ``guard failed'' message includes the address of the memory packet and the file name and line number of the code that called ckfree. This allows you to detect the common sorts of one-off problems, where not enough space was allocated to con- tain the data written, for example. DEBUGGING DIFFICULT MEMORY CORRUPTION PROBLEMS
Normally, Tcl compiled with memory debugging enabled will make it easy to isolate a corruption problem. Turning on memory validation with the memory command can help isolate difficult problems. If you suspect (or know) that corruption is occurring before the Tcl interpreter comes up far enough for you to issue commands, you can set MEM_VALIDATE define, recompile tclCkalloc.c and rebuild Tcl. This will enable memory validation from the first call to ckalloc, again, at a large performance impact. If you are desperate and validating memory on every call to ckalloc and ckfree isn't enough, you can explicitly call Tcl_ValidateAllMemory directly at any point. It takes a char * and an int which are normally the filename and line number of the caller, but they can actually be anything you want. Remember to remove the calls after you find the problem. SEE ALSO
memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory KEYWORDS
memory, debug Tcl 8.1 TCL_MEM_DEBUG(3)