malloc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • farshid
    New Member
    • Oct 2006
    • 9

    #16
    Originally posted by tyreld
    Are the size of your memory allocations constant over time? Is this the only dynamic memory allocation taking place? Are you using any recursion?
    Hi again,

    Yes, some of the functions are using recursion. This is not the only memory allocation and this one uses a constant memory over time, but some other memory allocations vary over time.

    Comment

    • tyreld
      New Member
      • Sep 2006
      • 144

      #17
      Originally posted by farshid
      Hi again,

      Yes, some of the functions are using recursion. This is not the only memory allocation and this one uses a constant memory over time, but some other memory allocations vary over time.
      I would suggest looking at your other memory allocations, and making sure that they are not leaking memory. It sounds like the one you suspect is not the cause. You also should try and determine how deep your recursion is going. Are there large data types local to your recursive functions? The problem with recursion is that deep recursion with large local data can exhaust stack memory as each recursive call requires a stack frame as well as local data being pushed on to the stack, and this data stays on the stack until the return call.

      Comment

      • sundarr
        New Member
        • Aug 2006
        • 9

        #18
        Hi,

        Although ur post still doesnt clear the exact nature of your problem, but according to the inadequate threads that hve been goin on, i would like to note the following points:
        1. If ur Pointer D is a global one then to free off the pointer inside a local function is a bad practice for u should always free memory in "its scope".
        2. Have u tried off with simulataneous alloc and free pipars inside a local function itself? Say u alloc ur pointer thru a function that gets the size passed, and use ur pointer and then free it in the same scope. although i aint sure that tis would work, but an effective way to avoid future troubles. :)

        Comment

        Working...