Value stored to 'dwDelay' is never read

Discussion in 'iOS Programming' started by rbeatajane, Jun 15, 2011.

  1. rbeatajane, Jun 15, 2011
    Last edited: Jun 16, 2011

    macrumors newbie

    Joined:
    Mar 11, 2011
    #1
    Hi


    The function below is causing me memory leak. I dont know why.
    I'm using dwDelay but its telling me dwDelay is never read.What mistake am i doing here.

    Code:
    -(uint8_t)timeoutThread
    {
    unsigned long int       dwDelay = 0;
    some stmts;
    while()
    {
     stmts;
    }
    dwDelay = 1000; //memory leak(value stored to 'dwDelay' is never read)
    }
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    I don't see how that will leak memory: dwDelay is a stack variable. It's not storing a pointer to something on the heap so at the end of the method it's storage will automatically be recovered from the stack. The analyser is correct though: that last statement has no point as the value can never be read.
     

Share This Page