Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-20-2010, 12:48 AM   #1 (permalink)
Registered Member
 
MegaJiXiang's Avatar
 
Join Date: Apr 2010
Posts: 53
MegaJiXiang is on a distinguished road
Wink Help? Instant Memory Leak if PNG image is added to XIB

1) Open up XCode
2) Create a new Project (iPhone OS->Application->View Based Application) *Make sure to set the product to iPad
3) Add a PNG file (This is what I am using) to the resources folder.
4) Open up either of the two XIB files that comes with your project in the Interface Builder by double-clicking
5) Click on Media and drag your image onto the big empty space
6) Save and quit Interface Builder
7) Build the project
8) In XCode, go to Run, Run with Performance Tool, Leaks
9) Watch the memory leak!

Anyone know why this happens or how to fix/prevent it? My app is done and as far as I can tell I have no leaks of my own but this one is driving me insane. The fact that I can get it to happen just by making a new app and adding an image bothers me. I tried making it an IBOutlet of my app's delegate and releasing it in the dealloc method but get the same result.
MegaJiXiang is offline   Reply With Quote
Old 04-20-2010, 03:51 AM   #2 (permalink)
Registered Member
 
MegaJiXiang's Avatar
 
Join Date: Apr 2010
Posts: 53
MegaJiXiang is on a distinguished road
Default

No one knows?
MegaJiXiang is offline   Reply With Quote
Old 04-20-2010, 01:36 PM   #3 (permalink)
Registered Member
 
MegaJiXiang's Avatar
 
Join Date: Apr 2010
Posts: 53
MegaJiXiang is on a distinguished road
Red face

I just tried the same thing by making an iPhone app and added some buttons and a text box. It starts leaking. Without these objects, there are no leaks.

Guys, help me out here.
MegaJiXiang is offline   Reply With Quote
Old 04-20-2010, 02:13 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 88
Blitfast is on a distinguished road
Default

There is no leak, it is cached.
Blitfast is offline   Reply With Quote
Old 04-21-2010, 01:53 AM   #5 (permalink)
Registered Member
 
MegaJiXiang's Avatar
 
Join Date: Apr 2010
Posts: 53
MegaJiXiang is on a distinguished road
Smile

Quote:
Originally Posted by Blitfast View Post
There is no leak, it is cached.
So what's the idea behind showing leaks if it's not a leak? How do I determine my own leaks when there are random other ones happening constantly from "caching?"
MegaJiXiang is offline   Reply With Quote
Old 04-21-2010, 04:48 AM   #6 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 89
kiancheong is on a distinguished road
Default

how 'leaky' is it? sorry, but i am not sure of the right terms here..

anyway, i've seen some leaks in my own apps as well, but most of the time these leaks come from Apple's frameworks.. i just leave it as it is.. not sure what others are doing, but i think Apple is the one who needs to fix it..
kiancheong is offline   Reply With Quote
Old 04-23-2010, 02:29 AM   #7 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 5
katierosy is on a distinguished road
Smile

The leak seems to be coming from Apple's CoreGraphics library. It does not matter whether the image is being added through IB or programmatically.
katierosy is offline   Reply With Quote
Old 04-23-2010, 01:17 PM   #8 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

Are you running it on the device? There are several Core Graphics leaks I only see when running on the simulator. As long as it goes away on the device, it should not be an issue.
JasonR is offline   Reply With Quote
Reply

Bookmarks

Tags
memory leak, uiimageview, xib

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 319
22 members and 297 guests
baja_yu, cgokey, chemistry, Domele, Duncan C, Fstuff, gbenna, givensur, guusleijsten, heshiming, HowEver, iAppDeveloper, iphonedevshani, jbro, JoeRCruso, mdpauley, n00b, newDev, seokwon lee, SLIC, stanny, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,875
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:32 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0