Professional Web Applications Themes

MallocBadFreeAbort -- does this actually work?? - Mac Programming

I know the environment is getting to the debugged process properly because I can see the output from setting MallocHelp. I have a program which is double-free'ing memory, and setting MallocBadFreeAbort to a non-0 value is doented to cause the program to abort, but it isn't. I can reproduce this in a three line program which purposfully double-free's a malloc'd pointer, so there aren't a lot of things for me to be doing wrong here. Is there a particular library or framework I need to use the doentation fails to mention? Or do I continue debugging my programs on Windows?...

  1. #1

    Default MallocBadFreeAbort -- does this actually work??

    I know the environment is getting to the debugged process properly
    because I can see the output from setting MallocHelp. I have a
    program which is double-free'ing memory, and setting
    MallocBadFreeAbort to a non-0 value is doented to cause the program
    to abort, but it isn't.

    I can reproduce this in a three line program which purposfully
    double-free's a malloc'd pointer, so there aren't a lot of things for
    me to be doing wrong here. Is there a particular library or framework
    I need to use the doentation fails to mention? Or do I continue
    debugging my programs on Windows?
    Paul Guest

  2. #2

    Default Re: MallocBadFreeAbort -- does this actually work??

    In article <google.com>,
    com (Paul Forgey) wrote:
     

    I've never heard of MallocBadFreeAbort, and Google gives only 2 hits. I
    find this suspicious.
     

    In that case, its probably a case of the docs refering to something that
    does not exist. You can get the Darwin source and grep for
    MallocBadFreeAbort to see if its implemented. :)

    But you can still debug your problem, following the advice here:
    <http://developer.apple.com/doentation/ReleaseNotes/DeveloperTools/Mal
    locOptions.html>

    Basically, just put a breakpoint on fprintf().
    Sean Guest

  3. #3

    Default Re: MallocBadFreeAbort -- does this actually work??

    In article <aei.ca>,
    Sean McBride <org> wrote:
     
    >
    > I've never heard of MallocBadFreeAbort, and Google gives only 2 hits. I
    > find this suspicious.

    >
    > In that case, its probably a case of the docs refering to something that
    > does not exist. You can get the Darwin source and grep for
    > MallocBadFreeAbort to see if its implemented. :)
    >
    > But you can still debug your problem, following the advice here:
    > <http://developer.apple.com/doentation/ReleaseNotes/DeveloperTools/Mal
    > locOptions.html>
    >
    > Basically, just put a breakpoint on fprintf().[/ref]

    Alternatively, if you call fprintf() in lots of places in your code, use
    malloc_printf() instead.

    -Eric

    --
    Eric Albert edu
    http://rescomp.stanford.edu/~ejalbert/
    Eric Guest

  4. #4

    Default Re: MallocBadFreeAbort -- does this actually work??

    In article (Dans l'article)
    <google.com>,
    com (Paul Forgey) wrote (écrivait):
     

    It works (I'm pretty confident it does with Jaguar and I used it with
    Panther yesterday) and it will abort whenever the double free message is
    printed.

    Just make sure the variable is set in your process. If you do a setenv (or
    export) in a terminal and launch your program in another it won't work.

    Also, if your program is an application, you probably want to launch it via
    the command line (through Application.app/Contents/MacOS/Application).

    However, it's true that with a three lines program, I wasn't able to
    reproduce the double free message on stderr (or the abort).

    Paul

    --
    Philosophie de baignoire - consultations sur rendez-vous.

    NewtonOS/NPDS: http://newton.kallisys.net:8080/
    FreeBSD/Apache: http://www.kallisys.com/
    Paul Guest

Similar Threads

  1. Links don't work in Shockwave movie but work in p
    By rokarege in forum Macromedia Director Basics
    Replies: 1
    Last Post: May 3rd, 02:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139