Bashar Shaya & Gustav Johansson

Minneshantering för iPhone: Begränsing eller möjlighet?

Sammanfattning

När iPhone släpptes för försäljning den 9e januari 2007 började en världsledande epok inom mobil- och smartphonebranschen. Apple lanserade senare samma år API för utveckling av programvara till iPhone. En helt ny värld blev tillgänglig för programmerare och därmed söktes kunskap och erfarenhet, vilket gav upphov till att iPhone blev den telefon man skulle programmera och utveckla för. För att bli en bra programmerare till iPhone måste man kunna hantera ett flertal viktiga aspekter. Det finns en begränsning på CPU, batteri men framför allt minne. Minnesbegränsningar är en stor och viktig del i iPhone-programmering. Man har ingen skräpsamlare i Objective-C, vilket är språket som används för utveckling av programvara för iPhone. Detta gör att man som programmerare måste hantera all minnesallokering på egen hand. För att skapa en variabel måste man allokera plats åt den för att sedan initiera den. Eftersom det är mycket lätt att program kraschar pga. felhantering av minnen och allokering, är det viktigt att man som programmerare är mycket uppmärksam på just allokeringen. Vi hoppas att man som programmerare blir nyfiken och intresserad av att börja programmera för iPhone, och samtidigt får nytta av den samling av information som vi har gjort på viktiga områden med fokus på minneshantering.

Memory Management for iPhone: Limitation or opportunity?

Abstract

When the iPhone was released for the market on January the 9th, 2007, a new era began in the ongoing and developing world of mobile- and smartphones. Later that year Apple introduced the API for the iPhone, which opened up doors for a whole new world of programmers and suddenly the iPhone was the phone to develop for. To become a good programmer for the iPhone, you have to deal with and have in mind several important aspects. The telephone has a limitation on the CPU, battery and especially the memory. The memory limitations are a large and important part of the iPhone programming. There is no garbage collector in Objective-C, which is the language used for developing software for the iPhone. This means that you have to deal with all kinds of memory allocation of one’s own accord when programming. To create a variable you need to allocate space for it, and then initialize it. Since program and system crashes often occurs, the mishandling of memory allocation makes that programmers must be very aware of the allocation. We hope that programmers will be interested and anxious to begin programming for the iPhone and that they benefit from this report, which has a wide collection of data that we have made for some key areas and especially with focus on memory management.