Memory leak iOS yog dab tsi?
Memory leak iOS yog dab tsi?

Video: Memory leak iOS yog dab tsi?

Video: Memory leak iOS yog dab tsi?
Video: Debugging in Xcode 13: Tips & Tricks (2022) – iOS 2024, Kaum ib hlis
Anonim

A nco xau tshwm sim thaum muab nco qhov chaw tsis tuaj yeem rov qab los ntawm ARC (Automatic Reference Count) vim nws tsis tuaj yeem qhia tau yog qhov no nco qhov chaw yeej siv los tsis tau. Ib qho teeb meem feem ntau uas tsim nco xau hauv iOS no yog khaws cia cycles peb yuav pom nws tom qab.

Kuj nug, dab tsi yog lub cim xeeb xau hauv iOS Swift?

A nco xau yog ib feem ntawm nco uas yog nyob mus ib txhis thiab tsis tau siv dua. Nws yog cov khib nyiab uas siv qhov chaw thiab ua rau muaj teeb meem. Nco uas tau faib rau qee lub sijhawm, tab sis tsis tau tso tawm thiab tsis raug xa mus los ntawm koj lub app.

Ib tug kuj yuav nug, ua li cas lub cim xeeb leak ua? Hauv computer science, a nco xau yog ib hom kev pab xau uas tshwm sim thaum lub computer program tswj tsis raug nco allocation nyob rau hauv xws li ib txoj kev uas nco uas tsis xav tau yog tsis tso. Ib qhov chaw xau tshwm sim thaum lub khoos phis tawj siv ntau dua nco tshaj qhov tsim nyog.

Ntxiv mus, lub cim xeeb xau nyob qhov twg hauv iOS app?

Kua muab cov cuab yeej zoo hu ua instruments rau nrhiav tus nco xau hauv ib daim ntawv thov.

Nrhiav lub cim xeeb xau hauv iOS apps nrog XCode Instruments

  1. Mus rau tableview uas muaj cov npe ntawm cov duab.
  2. Nyem rau ntawm daim duab kom pom cov ntsiab lus.
  3. Rov qab mus rau lub rooj saib ntawm cov duab.
  4. Ua raws li cov kauj ruam no rau ib ncig ntawm 30 - 40 zaug.

Kuv yuav ua li cas thiaj kuaj xyuas cov cim xeeb tawm?

Ib txoj kev kuaj rau nco xau yog nias thiab tuav koj tus yuam sij Windows thiab coj mus rhaub Pause / Break yuam sij kom nqa System Properties. Nyem rau ntawm Performance tab thiab kuaj System Resources rau feem pua ntawm cov dawb los yog muaj RAM.

Pom zoo: