Сообщения об утечке памяти в MonoTouch - нужно ли с ними бороться? - PullRequest
2 голосов
/ 13 февраля 2011

Я привык к ASP.NET, в котором есть сборщик мусора.Однако после того, как я приступил к программированию в MonoTouch и iPhone, я нахожу многие из этих сообщений при запуске моего приложения.

Я их игнорирую или мне нужно реализовать какой-то метод unload в каждом контроллере вида для удаления объектов?

Это те вещи, на которые ребята из Apple будут смотреть, когда я отправлю свое приложение в iTunes (я еще не сделал этого)?

2011-02-12 20:58:55.641 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xfd34dd0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.648 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xfd3a710 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.649 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xfd3a830 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.650 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xfd3bae0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.651 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce8a520 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.651 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce8a5e0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.658 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0x7bccd40 of class __NSArrayReverseEnumerator autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.659 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0x7bce550 of class __NSArrayI autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.659 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0x7bce550 of class __NSArrayI autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.660 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce8f280 of class NSIndexPath autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.664 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce90480 of class __NSCFData autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.664 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce90690 of class UICFFont autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.670 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce91c30 of class NSIndexPath autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.671 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xfd3a840 of class NSIndexPath autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.673 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0x7bcc550 of class CAlertView autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.674 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce91ca0 of class __NSArrayM autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.675 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0x6e87c10 of class _UIAlertOverlayWindow autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.675 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce90a50 of class UIInputViewSet autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.676 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce90a60 of class UIInputViewAnimationStyle autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.676 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce93bf0 of class CABasicAnimation autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.677 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce93c00 of class NSCFNumber autoreleased with no pool in place - just leaking
2011-02-12 20:58:55.677 wps[1200:7803] *** __NSAutoreleaseNoPool(): Object 0xce93a10 of class __NSCFDictionary autoreleased with no pool in place - just leaking

1 Ответ

6 голосов
/ 13 февраля 2011

Вы создаете объекты NSO в явно созданном потоке (не из пула потоков). Вы должны обернуть нить в

using (var pool = new NSAutoreleasePool ()) {
  // thread work goes here
}
...