Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in loading new tiles from RMDBTileImage source #158

Open
GoogleCodeExporter opened this issue Apr 18, 2016 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run routeme with RMDBTileImage as the tile source in Instruments and do an 
object allocation check
2. Move or zoom map (anything that initiates loading a new tile)
3. Watch the live bytes climb
4. Sort object list by "Live Bytes" and check the stack trace for any of the 
Malloc X bytes (where "x" is 36,32,24, etc.) and check the stack trace.

What is the expected output?

- No memory leak

What do you see instead?

A memory leak. It would appear that RMDBTileImage leaks a NSMutableData object 
on map move and scroll. It looks like the NSMutableData object used for 
creating the image is retained when setting the layer.contents property in 
UpdateImageUsingImage, although it is not clear how to reduce the retain count 
on the NSMutableData object at this point.


What subversion release are you using?

- Not sure - downloaded in early October and added the RMDBTileImage patch.

Does the behavior occur on the
simulator, a real iPhone/iPod Touch, or both?

Both

If you can reproduce your bug, please provide the source code for a
reproducing case. The best place to start is with the SampleMap project.

Please don't send patches/diffs. Post source code directly to the issue
tracker, noting your suggested revisions. If they are extensive, use a
branch in subversion with the same name as your issue number (e.g.
branches/issue59).

Please provide any additional information below.

I’ve checked to make sure that all of the objects being allocated are getting 
released and have tried every potential fix I can think of – looks like a 
very pesky bug! Any suggestions for places to look or vague ideas for potential 
fixes are welcome!

Here's the stack trace for the leak:

9 -[RMMapContents 
initWithView:tilesource:centerLatLon:zoomLevel:maxZoomLevel:minZoomLevel:backgro
undImage:] MapView/Map/RMTileLoader.m:211
8 -[RMTileImageSet addTiles:ToDisplayIn:] MapView/Map/RMTileImageSet.m:365
7 -[RMTileImageSet addTile:At:] MapView/Map/RMTileImageSet.m:263
6 -[RMCachedTileSource tileImage:] /MapView/Map/RMCachedTileSource.m:75
5 -[RMDBMapSource tileImage:] /MapView/Map/RMDBMapSource.m:222
4 +[RMTileImage imageForTile:fromDB:] Map/RMTileImage.m:168
3 -[RMDBTileImage initWithTile:fromDB:] Map/RMDBTileImage.m:106
2 -[FMResultSet dataForColumnIndex:] /Users/tobin1/Documents/Sutro 
Project/iPhone 
Guides/mobilelocal-offlinemaps/Classes/../Classes/FMResultSet.m:244
1 Foundation +[NSMutableData(NSMutableData) dataWithLength:]
0 Foundation -[NSConcreteMutableData initWithLength:]

Original issue reported on code.google.com by [email protected] on 19 Nov 2010 at 8:32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant