]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/curl/lib/README.memoryleak
Various Mac OS X tweaks to get this to build. Probably breaking things.
[icculus/iodoom3.git] / neo / curl / lib / README.memoryleak
1 $Id: README.memoryleak,v 1.3 2003/07/22 10:00:37 bagder Exp $
2                                   _   _ ____  _     
3                               ___| | | |  _ \| |    
4                              / __| | | | |_) | |    
5                             | (__| |_| |  _ <| |___ 
6                              \___|\___/|_| \_\_____|
7
8              How To Track Down Suspected Memory Leaks in libcurl
9              ===================================================
10
11 Single-threaded
12
13   Please note that this memory leak system is not adjusted to work in more
14   than one thread. If you want/need to use it in a multi-threaded app. Please
15   adjust accordingly.
16
17
18 Build
19
20   Rebuild libcurl with -DCURLDEBUG (usually, rerunning configure with
21   --enable-debug fixes this). 'make clean' first, then 'make' so that all
22   files actually are rebuilt properly. It will also make sense to build
23   libcurl with the debug option (usually -g to the compiler) so that debugging
24   it will be easier if you actually do find a leak in the library.
25
26   This will create a library that has memory debugging enabled.
27
28 Modify Your Application
29
30   Add a line in your application code:
31
32        curl_memdebug("filename");
33
34   This will make the malloc debug system output a full trace of all resource
35   using functions to the given file name. Make sure you rebuild your program
36   and that you link with the same libcurl you built for this purpose as
37   described above.
38
39 Run Your Application
40
41   Run your program as usual. Watch the specified memory trace file grow.
42
43   Make your program exit and use the proper libcurl cleanup functions etc. So
44   that all non-leaks are returned/freed properly.
45
46 Analyze the Flow
47
48   Use the tests/memanalyze.pl perl script to analyze the memdump file:
49
50     tests/memanalyze.pl < memdump
51
52   This now outputs a report on what resources that were allocated but never
53   freed etc. This report is very fine for posting to the list!
54
55   If this doesn't produce any output, no leak was detected in libcurl. Then
56   the leak is mostly likely to be in your code.