Closed dbrouard closed 10 years ago
Hi Diego, Oh our memory profiling there wasn't anything that stood out as a problem/memory leak, so perhaps there something we missed in a specific scenario or usage. It would be great if you could point out what you see in your app profiling, and where are the hot spots that involve Freestyle. Thanks!
I've tried to check the app using MAT, but, honestly, it's very hard to me to understand how it works. Can you give me some steps you need me to do so that I can give you more information?
I usually use the DDMS tool to create a method-profile snapshot when loading an activity. E.g., hit the 'start memory profile', let the activity load, and then hit the 'stop memory profile'. It will generate a table that will describe what was happening in terms of execution time. For memory profiling, there is a great Google IO talk that explains very nicely how to detect issues - https://www.youtube.com/watch?v=_CruQY55HOk
In this case, the main suspect would be the Bitmaps. If you get to see bitmaps references that are sticking there, that's probably the problem. How does your CSS look like? Also, do you style any lists/spinners?
Thanks, I'll have a look at youtube link right now.
About the Bitmaps, yes, the OutOfMemory errors are related to bitmaps all of them and the css is quite simple ( I paste it below ). The only list I style is using the class "sidebar" which I apply programmatically.
background-color:#ffc000;
}
color: #ffffff;
font-size: 58px;
font-size: 24px;
text-align:center;
} button { background-color: #FFC000; border-radius: 8px; color: #FFFFFF; font-size: 20px; line-height: 20px; padding: 10px 24px 11px 23px; } button:pressed { background-color: #D6CDB5; color: #FFFFFF; border-radius: 8px; }
background-image:url(bg_body.png);
background-repeat:repeat;
}
font-size:24px;
color:#B8A466;
font-weight:bold;
}
font-size:16px;
color:#B8A466;
line-height:140%;
}
border:1px solid #B8A466;
} .sidebar{ background-color:#fefbea; divider: #b8a466; divider-height: 1px; }
color:#b8a466;
font-size:20px;
}
border:1px solid #71674f;
}
font-weight:bold;
color:#71674f;
}
border:1px solid #000000;
}
Ok, this looks like a straight forward CSS. Why programatically, btw? You can add a 'class="sidebar"' in your list layout, and that should work as well. Are you doing anything special in your list adapter?
I put the class programmatically because I can't find in the doc how to apply a class at the xml layout, all the examples I've found is applying css to an "id".
About the listview, yes, it's a bit special, as it's a drawer listview
Ok, what if you just skip only the styling of the list view? List views are getting a bit of a special treatment with Freestyle since recycling is involved. Perhaps something is not aligning well there with your drawer list. Freestyle is actually proxying the adapters to hook up into the recycling process. We replace your adapter with a Proxy (see PXHierarchyListener#setAdapterProxy() and PXAdapterInvocationHandler). To get your original adapter, btw, you can call PixateFreestyle.getAdapter(AdapterView).
There is no significant difference. Anyway, I've found some interesting things ( thanks to that awesome video ).
The app with freestyle usually stays at ~15% of free memory, while, without, it stays at ~35%. In this app , images are important and they are used, so I think that freestyle does not have a memory leak, but put the app "in the edge", so, any memory peak becomes fatal.
At least, as I can see, the memory leak is in the app ( I hope I'm fixing it thanks to your video suggestion ), but on the other side, freestyle seems too heavy, at least for this app ( I'm using it in another apps and I haven't had problems by now ).
I really love freestyle, perhaps if I manage to get my app light I will be able to re-enable freestyle.
Thanks for your support!
No problem :) Let us know if you find any spots we can optimize in Freestyle, or send us a pull request in case you make a change and I'll be happy to take a look.
Hi, I'm having lots of problems using freestyle in android. I installed and made it work, but since I added it, I have many out of memory errors. I've optimized my own code and resources, but the only way I have to avoid these hangs is removing freestyle from the app.
I followed the steps and the default.css is very simple. My only answer is that freestyle itself has memory leaks. By now, I have to remove freestyle, at least from this app.
Any idea?
Thanks in advance, Diego.