Parth Bhatt
Parth Bhatt

Reputation: 19469

NSAutoreleasepool: Memory Management problem in iPhone app

__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking

This is what I get as warning in console. Though it doesnt create a crash but seems to be some memory management issue.

What could be wrong?

I have not autoreleased my segemented control.

Upvotes: 0

Views: 620

Answers (2)

itZme
itZme

Reputation: 1439

This problem commonly arise when you are using multi-threading. If you using threading, should create autorelease pool for that thread

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

//Code....

[pool release];

Upvotes: 7

Kazuki Sakamoto
Kazuki Sakamoto

Reputation: 13999

If you are using UISegmentedControl in a thread that is not main thread as @Martin said, it is not safe.

UIKit Framework Reference - Introduction

Note: For the most part, UIKit classes should be used only from an application’s main thread. This is particularly true for classes derived from UIResponder or that involve manipulating your application’s user interface in any way.

Upvotes: 0

Related Questions