Posts Tagged ‘bug’

…little help (oh, malloc)?

Monday, July 6th, 2009

i’m having a time of it tracking down a resource allocation bloat culprit in an iPhone app i’m working on. i’ve narrowed it down to when i’m rapidly updating the center property of a UIImageView. a snippet from the Instruments application is below:


there are hundreds (if not thousands) of these messages, and the object allocation graph trends steadily upwards. when i disable the portion of the method which updates the center property the allocations stop and the memory usage goes flat. this also only occurs on the device…the simulator does not exhibit this behavior.

i’m using UIImageView directly, without subclassing, and it contains data from a small PNG file. i’ve patched up several other leaks successfully today, and really wanted to nail this one too.

qmake / xcode bug

Tuesday, January 6th, 2009

super annoying…Qt advertises that you can make an xcode project file using qmake to enable native development on mac…i had never been able to get the golden cheetah project working in this way, even after following what little documentation i could find. each time i’d run “qmake -spec macx-xcode” would result in a non-parseable xcodeproj file. to date i’ve just been coding and compiling with a simple text editor.

justin had done some initial troubleshooting, eventually filing a bug report with trolltech. he determined that the QMAKE_CXXFLAGS = -DGC_BUILD_DATE=”`date +’\”%a_%b_%d,_%Y\”‘`” was causing the issue. commenting out the offending line to get a valid xcode project and having to create another define in a source file.

a dev from trolltech got back to justin confirming the bug and offering a workaround by manually adding the directive in the xcode target’s build settings. they also mentioned that a fix would be coming in a future version of qmake, but gave nothing specific. i spent most of the afternoon trying to follow this workaround to no avail. it was very frustrating. i looked at the project file that qmake created and something looked odd with how special characters in the qmake_cxxflags key were escaped with slashes. too many it seemed.

finally, i came across a forum post where someone was trying to set a define macro to have a string value – jsut what we are trying to do. the solution is somewhat a hack, a bandaid for a shortcoming of qmake… triple-escape the outside quotation marks. looks like: -DGC_BUILD_DATE=\\\”`date +’\”%a_%b_%d,_%Y\”‘`\\\”

it compiles fine on the linux (ubuntu) test box, manually on mac os x (using qmake/make) and also creates a valid (parseable) xcode project file, but it won’t compile in xcode. i still have to disable these lines in and add them in by manually later. for the time being, i’m planning to develop in xcode, and build test versions without the build date/version number and then compile beta/release versions by hand, which works fine.

for reference, here are the lines i’m referring to in

QMAKE_CXXFLAGS += -DGC_BUILD_DATE=\\\"`date +'\"%a_%b_%d,_%Y\"'`\\\"
QMAKE_CXXFLAGS += -DGC_SVN_VERSION=\\\"`svnversion . | cut -f '2' -d ':'`\\\"

the top two lines are string values; the bottom two values are integers. also note, this has been reported to not work in win32, but i haven’t tested it myself. after we get the mac/linux builds going i’ll get back to the win build.