Questions tagged [alloc]

207 questions
0
votes
2 answers

Working with Class, properties and initialization

I'm working on this assignment I found online (Intermediate App Development Using iOS). I'm stuck on part c and d, don't know exactly what its asking me to do. I know how to print int (%i) and object (%@), but %@ print all data? Any help or…
0
votes
0 answers

differences in 3d array allocation in C++

I'm working with some images in c++ so, due to size, I need to allocate some arrays. I need to use an specific function that only take array as argument. If I initialize the array as a global variable like this: double buffer[193][229][193]; I can…
Findios
  • 307
  • 1
  • 4
  • 14
0
votes
3 answers

What objects do I alloc/release

in Objective-C and simply speaking - am I correct when assuming that all pointer variables must be released when they're not used any more? Every pointer variable (*) is a class of some kind, or not? Every pointer variable therefore needs to be…
iFloh
  • 41
  • 2
0
votes
1 answer

Retain count -1: can somebody explain to me?

The image explain the problem (it isn't absurd??!)
Matteo Gobbi
  • 17,697
  • 3
  • 27
  • 41
0
votes
1 answer

what does slab_bufclt() in slab_get_obj() mean?

In Linux kernel, we have a function in mm/slab.c static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp, int nodeid) { void *objp = index_to_obj(cachep, slabp, slabp->free); …
dspjm
  • 5,473
  • 6
  • 41
  • 62
0
votes
1 answer

Programmatic Object Creation in Objective-C

Below there are two methods to programmatically alloc and init objects of various classes and 'types'. - (id)buildObjectOfClass:(NSString *)classString andType:(NSString *)typeString { id buildObject; Class className =…
0
votes
1 answer

Memory allocation, release and NSURLConnection in iPhone app

I'm hoping someone can help me with this. I'm struggling to find an answer to what should be an easy question. By the way, this is my first major obj-c project after years of using c and c# so feel free to point out things I'm failing on. I have…
Lee M
  • 336
  • 1
  • 5
  • 19
0
votes
3 answers

Alloc and init in Cocoa

Maybe this is a dumb question, but I really want to figure this one out. For example I have the following setup: // .h @interface MyClass : NSObject { NSView *myView; } // .m @implementation MyClass -(void)someMethod { // WHAT IS THE…
Eugene Gordin
  • 4,047
  • 3
  • 47
  • 80
0
votes
1 answer

allocating view controller the right way

i am trying to archiv something really simple. I add a property for a NSScrollView in my ViewController header file called PanelController: @property (strong) IBOutlet NSScrollView *listurls_fld; I add the ViewController.h file to my NSObject…
0
votes
1 answer

Create dynamics names for UIViews

All is in my title, i want to create some dynamics names, to allocate some differents UIViews but randomly. For example, i want to make : Level1 * level1view = [[Level1 alloc] init]; So i try to make some NSString like this : ClasseMap = [NSString…
user2057209
  • 345
  • 1
  • 6
  • 19
0
votes
3 answers

program hangs after inputting array

#include #include //#include int* mergeSort(int*,int); int* merge(int*,int*,int); void main() { int n;int i=0; int *a,*b; scanf("%d",&n); a=(int)malloc(n*sizeof(int)); for(;i
yoda
  • 25
  • 4
0
votes
1 answer

NSDictionary of uninitialized objects?

How can I store an uninitialized object in an NSDictionary? I think I would do it like this, but I’m not certain that it’s a good approach: NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: [MyObject1 alloc],…
Pelish8
  • 109
  • 2
  • 9
0
votes
1 answer

ObjC-Why it is incorrect when implement [alloc] and [init] methods separatly?

Never initialize an object without reassigning any pointer to that object. As an example, don’t do this: NSObject *someObject = [NSObject alloc]; [someObject init]; If the call to init returns some other object, you’ll be left with a pointer to the…
abyn
  • 11
  • 3
0
votes
2 answers

Initialize and allocate multiple variables/objects | Objective C

How would I turn this: xmlObject *system_domain = [xmlObject alloc] xmlObject *system_description = [xmlObject alloc] xmlObject *system_type = [xmlObject alloc] Into something where I would only have to write xmlObject and [xmlObject alloc]…
John
  • 3,037
  • 8
  • 36
  • 68
0
votes
3 answers

Using alloc in objective c for my own classes

When I use alloc on a class that I created (for example on stack class that has an underlying NSMutableArray object) will it apply alloc to all of the properties of it ? or do I have to override the alloc method to make sure that the alloc is called…
Cemre Mengü
  • 18,062
  • 27
  • 111
  • 169