Category Archives: Technology

Tips while profiling your app to solve low memory warnings and crashes

Just a quick post to share what I learnt while investigating crashes in my iPad app. The crash reports consistently showed low memory warnings before the crash so I started using instruments to profile the app. Here’s some tips that may help you out when you are stuck using the instruments tool:

Turn off Zombies. Zombies are great for debugging messages sent to de-allocated objects, but they come at a cost of memory – NSZombies are never deallocated. Turning this off immediately showed great reductions in terms of live bytes in the allocations instrument. Apple’s documentation advises zombies to be used only on the simulator while debugging and testing.

Mark your heap before and after performing actions on your app to inspect the memory changes introduced by the action. A simple evaluation to keep in mind is that if any set of actions returns the app to the same state as before the actions, the changes in heap before and after the set of actions should be close to 0. Any significant amounts detected here would signal a leak, which need not necessarily reflect in the leaks instrument profile. Many conditions, like circular references, may cause actual leaks to be ignored in the leaks instrument, but that’s the focus of another article.

The Allocations and Activity Monitor operates differently, and gives very different results. I made the mistake of assuming the ‘live bytes’ column in the allocations report to be what my app was consuming. While allocations reported that my app is using a consistant amount of memory, I was still receiving low memory warnings, so I finally decided to run activity monitor. Surprise – the low 6.3mb consumption in allocations actually translated to 180mb in activity monitor. Why is that so? Turns our when you deallocate memory in your app, or even if you are using ARC, the memory is only released at undetermined intervals when iOS feels like it. While allocations track every memory your app allocates and deallocates, the activity monitor gives a true reflection of your app’s memory footprint.

But of course, those latent released memory wouldn’t chalk up to 100 over mb’s. The real culprit turns out to be CoreGraphics, while it handles all on screen drawings and image operations behind the scenes. The real memory consumed by these operations are not reflected in allocations at all. ARC also does not track CG objects so do remember to release them properly.

Now knowing the real issue, I proceed to refactor and restructure my drawing code to improve reuse of bitmap contexts and reduce repainting areas by keeping track of dirty rectangles. Hope these tips would help give some ideas to those of you debugging your crashes at 3 in the morning. Do also share some of your own tips or experiences in the comments!

Calling all Singaporean smartphone users

Spent the weekend working on an interactive survey of Singapore’s mobile landscape focusing on the 3 mobile operators Singtel, Starhub, and M1. I figured none of the telcos will ever commission this sort of open data so I decided to put it out there and see what sort of response it can get. Everyone can leave their feedback on the map to help build a comprehensive and unbiased overview of our tiny nation’s network coverage.

Landing page of the Singapore's mobile landscape website

As you can see it’s still at a very rough stage so please excuse the bugs and usability issues. If you have a cool idea, do leave them here in the comments or drop me a mail, welcoming all feedback and suggestions. Please share to fellow Singaporeans!

http://singaporemobilelandscape.com

Galaxy Note 10.1 to include Photoshop Touch

The new Galaxy Note 10.1 will be released to the public on 16th August and Samsung has preloaded it with Photoshop Touch. This will be the first time that a feature of this kind has been included on a mobile device, so it marks a significant milestone in the technology world. This was made possible, after Samsung teamed up with Adobe Systems in order to load Photoshop Touch onto the new version of the Nexus. With this feature, users will be able to sync files to the Adobe Creative Cloud, as well as having access to 2GB of free storage space.

One of the advantages of the Galaxy Note 10.1 is its affordability when compared with computer systems. With its Stylus Pen, users can still use great apps, without having to spend a lot of money in order to obtain them. So while desktop computers may be useful for some things, like typing out documents and playing party poker, the new Galaxy Note 10.1 is a good choice for app lovers. Users can edit photos while they are on the move, with their fingers or the Stylus Pen, as there are many features within Photoshop Touch that make this easy.

The preloaded version of Photoshop Touch includes some great features, such as selection tools, layers, filters and adjustments. Users can edit images to create wonderful works of art, or simply to tweak the photograph and make it appear how they want it to. The unique camera fill feature uses the tablet’s camera to fill in an area on a layer, which is a very useful tool. There is also an integrated Google Image Search, with which users can look for images, as well as the ability to share images to Facebook. This new release signals the start of something great for app lovers and should go a long way to making many image editor’s lives easier.

Installing BlackBerry Tablet OS SDK for Adobe AIR

Users of 64bit windows might get frustrated installing the new BlackBerry Tablet OS SDK if you are not using the 32bit Java Development Kit (JDK). When you run the .exe from BlackBerry, an error claims that “Win64 not supported. The author of the package you are installing did not include support for this platform.” The solution is trivial:

Unzip “BlackBerryTabletSDK-Air-Installer-0.9.0-Win.exe” and you should see 2 folders, “InstallerData” and “Windows”. Go into the Windows folder and find the .lax file.

Open the file in a text editor and change this line

lax.nl.current.vm=

to

lax.nl.current.vm=[your path to java.exe]

If you are not sure where is your JDK installation, check your C:/Program Files (x86)/Java folder for a folder named like jdkx.x.x_xx. Open it and look for the bin folder inside, your java.exe should be inside. For example, my path would be:

lax.nl.current.vm=C:/Program Files (x86)/Java/jdk1.6.0_22/bin/java.exe

Save the file and run the .exe in the same folder (BlackBerryTabletSDK-Air-Installer-0.9.0.201010221500.exe) to start the installation.

If you do not have your JDK yet, get it at http://www.oracle.com/technetwork/java/javase/downloads/index.html

Skype for Windows Mobile 6

Apparently Skype decided to discontinue the Skype client for Windows Mobile 6, although existing installations would continue to run. I’m glad that I only found this out after I bought my skype credits.

But thankfully the .cab file can still be found online, and they work fine on my HTC Diamond 2.

http://www.4shared.com/file/GrqhiMzD/Skype_v300256_For_Windows_Mobi.html
http://www.box.net/shared/static/rxi1nb6j3q.cab

God I didn’t know I was buying myself into so much trouble when I got my Diamond 2

BMW Gina

A car with flexible skin and movable metal structures beneath. Theoratically, you an better customize the look of your car, it is scratch resistant and it probably costs less to change the entire “cover” too. But the best part is that it also consumes much less energy to manufacture these compared to full metal casings. Safety is not an issue because crash damping and structural integrity is handled by the frame. Love the lights.

Sixth Sense by Pranav Mistry

What’s fascinating about this project is less of the technology than the new form of user interaction that takes advantage of the unique capabilities of this wearable device. The later half of the talk gives a preview of some of these gestures Pranav have designed.

TED Talk
Website: http://www.pranavmistry.com/projects/sixthsense/

New Indie game – Trauma

Chanced upon this indie game which had a game visual similar to that of microsoft’s photosynth demo.

Of course it only looks similar on the surface, the underlying technology seems much different in the sense that its unlikely the engine will arrange and stitch your photos in 3d. Having said that, the game play looks interesting enough.

Source: http://www.indiegames.com/blog/2009/11/trailer_trauma_krystian_majews.html