Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 16, 2011, 01:13 AM   #1
rbeatajane
macrumors newbie
 
Join Date: Mar 2011
Value stored to 'dwDelay' is never read

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)
}

Last edited by rbeatajane; Jun 16, 2011 at 03:28 AM.
rbeatajane is offline   0 Reply With Quote
Old Jun 16, 2011, 04:48 AM   #2
robbieduncan
Demi-God (Moderator)
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
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.
robbieduncan is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How To: Use your iPhone to store your documents for later reading! - Very Useful dharrison9 iPhone Tips, Help and Troubleshooting 19 Jun 30, 2012 08:47 AM
How to Make Sure a File is Never Replaced? thriii Mac OS X 13 Nov 24, 2009 12:41 PM
iPhone Book: we'll never read one of it ! fa.ce iPhone/iPad Programming 1 Sep 25, 2008 04:22 PM
Is it possible to restore phone to 2.0? (please read entire question) BobboZR2 iPhone 4 Aug 9, 2008 03:48 PM
I think I just found an iPhone feature I've never read on the net...Anywhere. Vegeta-san iPhone 29 Nov 22, 2007 10:41 AM


All times are GMT -5. The time now is 11:52 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC