memory-management

IBOutlet on properties and exposition of the class

Apple, for memory management issues, recommend defining outlets on properties, not in the attribute declaration. But, as far as I know, declaring properties exposes the class to external classes, so this could be dangerous. On UIViewController we have the main view definition and the logic, so MVC is slightly cheated in this cases. Wha...

Will a Winforms grid keep its datasource in memory? .Net

Hello I've a grid in my winforms application and i bind a huge dataset to the grid. Will the dataset be stored in the memory by the grid after calling DataBind(). How does it operate on the data binded to the grid? Update I wrote the following code DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection("...

Multiple .NET processes memory footprint

I am developing an application suite that consists of several applications which user can run as needed (they can run all at the same time, or only several..). My concern is in physical memory footprint of each process, as shown in task manager. I am aware that Framework does memory management behind the curtains in terms that it devot...

AutoComplete Texbox error - write to protected memory

I have an autocompleate textbox that looks into a data base. Some times while I'm typing I received the following error. Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Here is the code private void tBSearchName_TextChanged(object sender, EventArgs e) { ...

Obj-C: calling release/dealloc causes EXC_BAD_ACCESS

Here is my custom class: PolygonShape : NSObject { int numberOfSides; int minimumNumberOfSides; int maximumNumberOfSides; } My custom init method: - (id)initWithNumberOfSides:(int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max { if (self = [super init]) { [self setMinimumNumberOfSides:min]; [self setMaximu...

Memory scope of an anoymous object - C#.Net

Hello I've the following code DataView dvTest= dsTest.Tables[1].Copy().DefaultView; Will the copy of the (huge) dataset dsTest be persisted in the memory or will it be Garbage Collected by default? Does it copy the whole dataset to the memory? When the GC happens? Regards NLV ...

How to identify whether the objects are just referenced or just copied? .net Memory Management

Hello I'm confused to find whether an object is either copied or the reference of the object is held while equating it to some other objects. Examples int i =5; int j = i; Reference or copy of data? DataSet ds = dsOtherDataSet.Copy(); Reference or copy of data? DataView dvTemp = dsTestDataSet.Copy().DefaultView; What happens h...

Dealing with UIImagePickerController to minimize memory useage

So, I have read the SO post on UIImagePickerController, UIImage, Memory and More, and I read the post on Memory Leak Problems with UIImagePickerController in iPhone. I have VASTLY increased my memory efficiency between these 2 posts, and I thank the OPs and the people that provided the answers. I just had a question on the answer provid...

Can get members, but not count of NSMutableArray

I'm filling an NSMutableArray from a CoreData call. I can get the first object, but when I try to get the count, the app crashes with Program received signal: “EXC_BAD_ACCESS”. How can I get the count? Here's the relevant code - I've put a comment on the line where it crashes. - (void)viewDidLoad { [super viewDidLoad]; managedObjec...

Vala memory management

I am going to call a Vala function from C, and I have a question about memory management. The function looks like this in Vala: int[] GetNumbers(); and is translated by valac to C like this gint* GetNumbers(int* result_length1); When the above function gets called from C, is the caller responsible for freeing the gint* array? ...

What exactly is a memory page fault?

From the docs: Note: Core Data avoids the term unfaulting because it is confusing. There's no “unfaulting” a virtual memory page fault. Page faults are triggered, caused, fired, or encountered. Of course, you can release memory back to the kernel in a variety of ways (using the functions vm_deallocate, munmap, or sbrk...

Basic C question, concerning memory allocation and value assignment

Hi there, I have recently started working on my master thesis in C that I haven't used in quite a long time. Being used to Java, I'm now facing all kinds of problems all the time. I hope someone can help me with the following one, since I've been struggling with it for the past two days. So I have a really basic model of a database: t...

If I CFRelease() an image in core data, how do I get it back?

My iphone app plays a slide show made up of 5 user images.  These images are stored using core data.  I was noticing that memory was building up every time a different slide show was played and it was not releasing any of the previously played slide shows.   These images are showing up in Object Allocations as CFData. So I tried releasin...

What is the correct way to open and close window/dialog?

I'm trying to develop a new program. The work flow looks like this: Login --> Dashboard (Window with menus) --> Module 1 --> Module 2 --> Module 3 --> Module XXX So, to open Dashboard from Login (a Dialog), I use Da...

Why Should I Use Retain With Convenience Methods?

Hi, I am using the this code in my iPhone application: UIButton * MyButton=[UIButton ButtonWithType:UIButtonTypeRoundRect]retain]; If I don't use this retain will my app crash? What is the function of this retain? ...

PHP Array Efficiency and Memory Clarification

When declaring an Array in PHP, the index's may be created out of order...I.e Array[1] = 1 Array[19] = 2 Array[4] = 3 My question. In creating an array like this, is the length 19 with nulls in between? If I attempted to get Array[3] would it come as undefined or throw an error? Also, how does this affect memory. Would the memory of 3 ...

Should repeated use of the camera crash an app?

I have an app that builds a slideshow from user images. They can grab from their library or take a picture. I have found that repeated use of grabbing an image from the library is fine. But repeated use of taking a picture causes erratic behavior. I have been getting crashes but mostly what happens seems to be a reloading of the view ...

When are temporaries created as part of a function call destroyed?

Is a temporary created as part of an argument to a function call guaranteed to stay around until the called function ends, even if the temporary isn't passed directly to the function? There's virtually no chance that was coherent, so here's an example: class A { public: A(int x) : x(x) {printf("Constructed A(%d)\n", x);} ~A() {...

Getting crash after picking images from UIImagePickerController (Related to memory leak?)

I have been trying to minimize my memory footprint with UIImagePickerController, but I'm starting to think that the memory problems I am having are resulting from poor memory management, instead of a particular way to handle the UIImagePickerController object. My workflow is this: The "Edit Image" button is clicked, which presents a UIA...

Miscellaneous Performance

Is it faster to make a comparison or a cast in C#.Net? For example: bool? flag = null; ... if(flag == true)... or if((bool)flag)... Also, what is the cost (in memory) of a cast? ...