I am setting my height:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat rowHeight = 0;
if(indexPath.row == [self.items count]){ //more
rowHeight = 50.0; //same as moreCell
}
else{
ChartlyCell *cell = (ChartlyCell*)[self tableView:tblView cellFo...
What will happen if the autorelease is removed from cell creation in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
STVCell *cell = (STVCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[STVCell alloc] initWi...
I have an app that holds a lot of pictures and when the user browses them the live bytes in my app gets to max 88 mb.
firstly what does that me, The app doesnt crash, it gets a little slower. but is that 88mb in memory ?
Secondly I have a UIView which I set its view to an image depending on the number in the counter. Is there a way to...
Hi,
I have been using ojective c for almost a week, and I am mainly a c++ coder. After I read Apple's memory management guide, I try to bring my memory usage style in c++ into objective c... I tried to conclude these scenarios, I think I won't make memory mistake if I follow these instructions. Please kindly let me know if I am wrong :...
Hello,
My app is running out of memory. To resolve this, I free up two very large arrays used in a function that writes a framebuffer to an image. The method looks like this:
-(UIImage *) glToUIImage {
NSInteger myDataLength = 768 * 1024 * 4;
// allocate array and read pixels into it.
GLubyte *buffer = (GLubyte *) malloc(my...
I'm fairly sure the answer to this is 'no, don't be stupid', but as they say, there are no stupid questions (only stupid people asking them).
I want to calculate the offset of an array. I have a void * handle to it and the sizeof(element). I don't have an x* pointer (where x is the type of the element).
Is there any way I can cast the...
I have a .NET program that is utilizing CUDA.
The CUDA is accessed through a C DLL.
What I am doing is initializing my CUDA application by allocating buffers (cudaMalloc) on the device at program startup. Pointers to these buffers are then maintained in static variables declared in the DLL. Data is copied to and from the buffers thro...
I came across this presentation while browsing SO some time ago, and it relates performance to specific memory allocation decisions. The author has some interesting diagrams that show how various objects are allocated by a C++ program, and goes on to optimise the program by making some changes in the code. His diagrams make sense in thei...
I use properties pretty much anytime my classes need iVars. For retained properties, I have grown accustomed to a specific way of using the accessor methods to alloc/initialize the actual iVars:
- (void)anInitOrAccessorMethod
{
self.property = [[AClass alloc] init];
[self.property release];
}
Anytime I need to set a non-autoreleas...
Hey guys,
another memory management question:
I have asked this before, but did not really get an answer:
The question is would the following result in a leak or is it ok?
NSArray *txtArray = [NSArray array];
NSString *aTxtFieldTxt = [[NSString alloc]initWithString:aTxtField.text];
aTxtFieldTxt = [aTxtFieldTxt stringByTrimmingCharacte...
Hi Forum
I'm a little confused about objc and allocating/releasing objects.
If I do this:
NSString *myString;
if([someString isEqualToString: @"test1"]){
myString = @"got 1";
}else{
myString = @"got 2";
}
Do I have to release myString after that?
And the same with self-defined objects:
myOwnObject *someObject = [someArray...
Does anyone know why xCode's "build and analyze" would report this line as a "possible memory leak"?
goodSound = [[SoundClass alloc] initializeSound:@"Good.wav"];
///// Here are the 4 files in question:
// Sounds.h
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
@interface SoundClass : NSObject
{
...
Probably everyone ran into this problem at least once during development:
while(/*some condition here that somehow never will be false*/)
{
...
yourvector.push_back(new SomeType());
...
}
As you see the program starts to drain all system memory, your program hangs and your system starts to swap like crazy. If you don't rec...
Hi guys I'm debugging my application here and basically in a nutshell - the application is dying out on my online server or maybe its my server dying out. But I have checked this application three different servers and all exhibited similar results, the application would run for a while but all of a sudden once I'd be opening more and mo...
Hi guys I'm trying to optimize my application here and have started to benchmark snippets of code as to how much memory they are taking up. I just discovered that a single include statement is taking up to 1.5MB of memory. I'm using memory_get_usage() to check for memory used before adn after a snippet of code.
The file included include...
I have a wrapper managed application(.net) over a COM Component(created using vb6) where Com component also uses native c++ dll.
Aplication runs as a background process and is supposed to run continously 24 X 7.
The application runs fine for certain time, but after certain time it crashes.
Possible reasons might be momory leak in c++ d...
Completely new to Objective-C, trying to find out when I need to alloc and release objects.
For example, I want to fetch some data from the Web. I found an article at Apple which has this code:
NSURLRequest *theRequest=[NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.apple.com/"]
cac...
I am having a lot of trouble getting m core data objects to be deallocated. I even tried the simplest test I could think of and I watched the retain count and it always seems to be higher than I expect. I also put a breakpoint on the dealloc routine for the core data objects and it doesn't seem to get called (at least not unless I specif...
Hey guys, lately I have been asking quite a few questions about memory management on the iPhone. Fortunately things are getting clearer. But I still struggle when it gets more complex: So is there something wrong with this in terms of memory mangement? My question and suggestions are in the comments...
//I get a text from a textfield
NS...
I have a few time-consuming and (potentially) memory-intensive functions in my LAMP web application. Most of these functions will be executed every minute via cron (in some cases, the cron job will execute multiple instances of these functions).
Since memory is finite, I don't want to run into issues where I am trying to execute a funct...