Questions tagged [alloc]
207 questions
0
votes
1 answer
Whether the alloc method increments the reference count of the object
When we call alloc with a Class, Whether the object's reference count will be 1.
For example:
NSObject *obj = [NSObject alloc];
After this line of code is executed, the reference count of the object is 0 or 1?
I read the alloc source code, But…
0
votes
1 answer
How can i resolve this memory leak?
this is my snippet:
- (id) initWithFrame:(CGRect)frame andConfig:(PGParams*) params
{
for (int i=0; i<[conf.map count]; i++)
[conf.map replaceObjectAtIndex:i withObject:
[[NSString alloc] initWithFormat:@"%@&sito=%@",
[conf.map…

elp
- 8,021
- 7
- 61
- 120
0
votes
2 answers
Is a memory leak created by a series of [array addObject:[[NSNumber alloc] initWithBool:someVariable]?];
Do I create multiple memory leaks by:
NSMutableArray *array=[[NSMutableArray alloc] init];
[array addObject:[[NSNumber alloc] initWithBool:boolVariable1]];
[array addObject:[[NSNumber alloc] initWithBool:boolVariable2]];
[array addObject:[[NSNumber…

Peter Kramer
- 231
- 3
- 7
0
votes
3 answers
alloc and init in a subclass
I have subclassed UIView and provided my own drawRect, which works fine. However I added these methods to my subclass:
- (id) alloc
{
NSLog(@"Alloc");
return [super alloc];
}
- (id) init
{
NSLog(@"Init");
if (self = [super…

Jonathan Starr
- 236
- 4
- 15
0
votes
0 answers
iOS - alloc called twice with different results
First, I'm bridging Appcelerator with native iOS code and I don't have access to Hyperloop. The following functions exist in the native iOS code. They are compiled as an iOS module and called directly from the Appcelerator…

B.T.
- 41
- 7
0
votes
1 answer
how to dealloc NSMutableDictionary
I call createTableData from viewDidLoad. What I don't understand is I'm doing an alloc for a NSMutableDictionary but I don't understand why that object is not released from memory-despite the release.
I do see memory leaks and Leaks seems to point…

uncivilized
- 3
- 1
0
votes
1 answer
alloc and free of 2d array
I made 2d array(matrix) + alloc and free functions to manage memory but it isnt working well, valgrind prints many errors and information that memory was lost.
Alloc: parametr s means size of matrix
int** alloc(int s)
{
int** matrix;
int…

Dawid Muserski
- 11
- 2
0
votes
1 answer
What does Alloc Limit mean in Opera TV Emulator?
Opera TV Emulator User Guide says it can config both alloc limit and heap limit. Heap limit is obvious. But alloc limit means what?
https://dev.opera.com/tv/opera-tv-emulator/#settings

springuper
- 508
- 4
- 11
0
votes
1 answer
Does copy allocate the required memory?
Here is an example taken from Apple iPhone SDK project:
@interface EADSessionController : NSObject {
EAAccessory *_accessory;
EASession *_session;
NSString *_protocolString;
NSMutableData…

user255607
- 1,829
- 5
- 25
- 28
0
votes
1 answer
initWithNavigationBarClass and UINavigationBar init methods
I am using UINavigationController's initWithNavigationBarClass:toolbarClass:
to initialize an instance UINavigationController with a Custom Navigation Bar MyCustomNavigationBar.
[super initWithNavigationBarClass:[MyCustomNavigationBar…

Ríomhaire
- 3,084
- 4
- 25
- 40
0
votes
1 answer
'std::bad_alloc' in Java program
I have a java process which I startup and let run for several days. The logs for this process looked fine up until the very end of the process's lifetime where I see the following two lines, and then nothing after it.
terminate called after throwing…

almel
- 7,178
- 13
- 45
- 58
0
votes
3 answers
Objective C: [MyObject alloc] now crashes under iOS SDK 4.1
I'm working on an existing, large-ish codebase, and after upgrading the iOS SDK to 4.1 I am now seeing very strange behaviour. The crux of the matter appears to be a particular class that will no longer alloc - it is throwing a bad access in…

Echelon
- 7,306
- 1
- 36
- 34
0
votes
1 answer
Random malloc crashes in stringByReplacingOccurrencesOfString
I am getting random malloc crashes in stringByReplacingOccurrencesOfString. I've noticed that it crashes on longer strings, but I can't seem to find why. What could be the problem?
The error:
CashTrader(53448,0xb0103000) malloc: *** error for object…

futureelite7
- 11,462
- 10
- 53
- 87
0
votes
1 answer
UIStackView alloc call returning nil only on actual ipad, not on simulator
I'm getting some strange behavior.
UIStackView *stackView = [UIStackView alloc];
stackView = [stackView initWithArrangedSubviews:@[self.subview1,self.subview2]];
[self addSubview:stackView];
[stackView…

Justin
- 119
- 9
0
votes
1 answer
I alloc a viewcontroller without init , but why everything works fine
I alloc a viewcontroller without init it, but everything works fine. The subviews in the viewcontroller work fine.
Here is the code.
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
[self.window…

Zentopia
- 735
- 1
- 8
- 14