Questions tagged [alloc]
207 questions
2
votes
4 answers
Cocoa : Objects allocated but not properly accessible?
That's what I have :
Class A :
#import "ppCore.h"
@interface ppApplication : NSApplication {
ppCore* core;
}
@property (assign) ppCore* core;
@end
@implementation ppApplication
@synthesize core;
- (void)awakeFromNib
{
[self…

Dr.Kameleon
- 22,532
- 20
- 115
- 223
1
vote
1 answer
Is it incorrect to re-assign to a pointer which contains an autoreleased object?
What is the result of the following?
NSString *myStr = [[[NSString alloc] initWithString:@"Hello World."] autorelease];
myStr = [NSString stringWithString:@"Hello Again."];
Does myStr get correctly released or does this crash, since we would call…

VTS12
- 452
- 8
- 22
1
vote
2 answers
MFMessageComposeViewController first alloc takes seconds
I am trying to show an MFMessageComposeViewController with the following code:
controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
controller.body = [NSString…

danielbeard
- 9,120
- 3
- 44
- 58
1
vote
2 answers
ios alloc-release
My app is receiving memory warnings because it's asking for lot of memory. I try to release every allocation. However, sometimes I don't know how to do it.
For example: I have two pairs of .h and .m file. One of them makes connections with a server…

Ibai
- 568
- 1
- 7
- 21
1
vote
1 answer
Freeing memory used in a timer block but allocated out of it, when stopping the timer
I am declaring a timer specifying its code with a block (in order to executing this code every x seconds).
I want the timer to start when the user taps a button, so I create and resume the timer inside a function which is an IBAction.
Finally, and…

angeleke
- 219
- 2
- 10
1
vote
4 answers
Is it ok to allocate released object again?
if i did this
Object * myObject = [[Object alloc]init];
[myObject release];
is there anything wrong about allocating my object in next line
myObject = [[Object alloc]init];
again?

Andrey Chernukha
- 21,488
- 17
- 97
- 161
1
vote
4 answers
Why does implicit initialization of a variable not work consistently on iPhone?
So here is my scenario -- In the header file of a class I do:
@interface MyClass : NSObject
{
NSString *string1;
NSString *string2;
}
- (void) methodOne: (NSString *) passedString;
- (void) methodTwo: (NSString *) passedString;
@end
In the…

Joshua Goossen
- 1,714
- 1
- 17
- 36
1
vote
1 answer
Refer to an extern crate in macro expansion
I'm trying to write some macros that work in nostd environment as well as in std environment. In order to do so I have this kind of code in proc macro crate:
#[cfg(not(feature = "alloc"))]
{
quote!(err.message =…

digital illusion
- 497
- 3
- 19
1
vote
1 answer
Problem realeasing allocated objects
Crash occurs at [searchDict release]. If I switch order of the two latest lines it still crash on the latest line (now [searchArray release]). I'm quite new to Objective C and I guess I haven't got the alloc/release right... Help?…

user872661
- 251
- 2
- 13
1
vote
6 answers
How many objects are created if alloc'ed in a loop
I'm trying to get my mind around one aspect of memory management in the iPhone SDK.
If I ran:
for (int x = 0; x < 10; x++) {
NSMutableArray *myArray = [[NSMutableArray alloc] init];
}
Am I creating 10 myArray objects in memory, or does each…

Jeremy
- 883
- 1
- 20
- 41
1
vote
0 answers
ImportError - from qiskit import BasicAer
I used
conda create --name qc-26 --clone base;
conda activate qc-26;
jupyter notebook
Whenever I ran,
from qiskit import BasicAer
I received the following error messages
ImportError:…

Ka-Lok Ng
- 11
- 1
1
vote
1 answer
Proper way to fill nested struct in C from file
I read data from a file that I want to fit into a structure. This structure contains an array of variable size. So I am using realloc to fill it on the fly. Unfortunately my program fails. Valgrind reports a pb with realloc:
==3170== Invalid write…

user2030243
- 49
- 1
- 6
1
vote
3 answers
Objective C: release and alloc
I'm pretty new to C and Objective C, however I can't find this answer
So I ran into a problem that took me a while to work out, basically I was told that when ever you alloc an object you should release it. So that is what I did and it caused my…

rafal
- 13
- 4
1
vote
1 answer
Resizing a two dimensional array in C. Memory leak
So I have a two dimensional dynamic array and I have to resize it. After I resize it the compiler says that it can't access the memory trough a format like this: array[i][j]
void resize(int **array,int newsize,int size){
int…

hokkyo
- 13
- 2
1
vote
1 answer
mmap more than one buffer in kernel is crashing please help (using dma_mmap_coherent)
I'm developing a Linux kernel module that allocates more than one buffer per char device and then the user-space application maps those buffers to the user-space. My character device class has around ten or more buffers and on open time I allocate…

Mathieeo
- 23
- 3