memory-management

Implementing a network pager as an alternative to disk paging. Suggestions?

Hi guys, I am working on a project where I am required to create a page fault handler that uses memory from a different computer connected via a network as opposed to redirecting page faults to the local hard disk. Our idea parts from the assumption that, with the speed of the networks nowadays, it would be advantageous to use remote mem...

Python reclaiming memory after deleting items in a dictionary

I have a relatively large dictionary in Python and would like to be able to not only delete items from it, but actually reclaim the memory back from these deletions in my program. I am running across a problem whereby although I delete items from the dictionary and even run the garbage collector manually, Python does not appear to be fr...

Objective-C: Memory-wise, what do I need to do with other pointers to a released object?

For example say I have: NSMutableArray *array = [[NSMutableArray alloc] init]; NSMutableArray *array2 = array; [array release]; is this legal? Do I just leave array2 dangling since I already released the object that was taking memory? ...

UITabBarcontroller is unresponsive

I have noticed several times that the UITabController is not very responsive to touches on the individual tabs. What I did to show this is I implemented the following method from the UITabBarControllerDelegate and saw every time it got fired: - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIVie...

What is the point in a retain immediately followed by an autorelease?

I'm looking at some open source code and trying to understand why the author has done something in a particular way. The class is a wrapper around NSArray to create a stack data structure with push, pop, etc. One method is topObject which returns the topmost object on the stack and its implementation is: - (id)top { return [[[stac...

Heap memory behaviour

I always had a question about heap memory behaviour. Profiling my app i get the above graph. Seems all fine. But what i don't understand why,at GC time, the heap grows a litle bit, even there is enough memory (red circle). That means for a long running app that it will run out of heap space at some time ? ...

Allocating memory for delayed event arguments

Here is my issue. I have a class to create timed events. It takes in: A function pointer of void (*func)(void* arg) A void* to the argument A delay The issue is I may want to create on-the-fly variables that I dont want to be a static variable in the class, or a global variable. If either of these are not met, I cant do something lik...

C# Overhead of evaluating 13 bits instead of native 16 bits

I'm compiling a lookup table that needs to have 133,784,560 entries, with values ranging from 0 - 7,462 The maximum value of 7,462 can be contained within 13 bits. This gives us a lookup table of around 207 MB. A 16 bit value increases our lookup table size around 50mb more. The extra increase in size of the lookup table is not signi...

Release a listener / observer in Objective-C?

Hi guys! I'm not sure when it's the right moment to RELEASE a listener object. I have a object A that uses NSURLConnection's initWithRequest method to retrieve some URL. initWithRequest requires a delegate to listen after the events of dataReceived... So object A creates an object B and passes it as a delegate for initWithRequest metho...

Why n in varchar(n) is to be specified as concrete digit?

I did red-read on this and could not clearly understand... Having (for the purpose of shortening this question) DECLARE @temp VARCHAR(4001); --update: 4001 is for example only to avoid varchar(MAX) discussions -- I am aware about 8000 SET @temp = 'a'; does SQL Server reserve 4001 bytes for @temp which (the rest 4000 from 40...

Memory Management - How and when to write large objects to disk.

I am working on an application which has potential for a large memory load (>5gb) but has a requirement to run on 32bit and .NET 2 based desktops due to the customer deployment environment. My solution so far has been to use an app-wide data store for these large volume objects, when an object is assigned to the store, the store checks f...

_dyld_start causing leaks in iphone apps

Using the Allocations Instrument on my Iphone Device, I notice in my heapshots that all my heap growth is caused by the _dyld_start caller (of dyld library). Here is an example: Snapshot: UIImageView Heap Growth: 4.83 Kb Still Alive: 103 When I look in the details, all I see is several instances of the following: Object Add: xxxx C...

Strange iPhone NSTableView cell.textLabel.text Bug?

Hey guys, I'm working with a UITableViewController, and I have a section of code as follows: Subject *subject = [[context subjects] objectAtIndex:[indexPath row]]; cell.textLabel.text = [subject name]; cell.showsReorderControl = YES; return cell; This code is in the UITableViewDataSource method that returns an UITableViewCell for an...

Memcache for pagination

This feels like a really bad idea on implementation and I'm not sure of the speed savings given the potential cost in memory. Using Dalli and Memecache to store a set of data that gets pulled on every page request that needs to be paginated. Its a lot of data so I'd really rather not keep hitting the database if possible, but I also don...

c++ pointer management with local variables

I've got a method that creates some Foo and adds it to a vector of Foos. Foos are in charge of deleting their Bars during destruction. The Foo constructor takes a pointer of Bars and a size of them. When the function returns, the local Foo gets deleted and destroys its Bars, however I get a valid Foo object back. How should I be handlin...

issue about subview retain superview in objective-C

Hi, here's a problem with memory management issue. Say i have a view A, it has a pointer that points to its subview B. I use @property(nonatomic, retain) refer to the view B. Now in subview B, i need a pointer to point back to its superview A. So i use another @property(nonatomic, retain) refer to its superview A. Here's my concern, i...

Memory management in java

Where objects,variable variables,temporary variable are stored in java? How they are referenced? I know that methods are being stored in stack. where variables are stored heap or stack? ...

Objective C, Memory Management

1) What is the reason for the use of retain? For example, in a setter method: - (void) setCount: (int) input { [intCount autorelease]; intCount = [input retain]; } 2) the autorelease-Method: Is it deleting an old object or preparing the new one? 3) Why the retain-method is called at the input-object? Would intCount = inpu...

App crashes when used with Allocations Instrument

I have seen that my app crashes when used with the Allocation Instrument. When looking at the device logs, I can tell that it is a 'Low memory' crash. My app process in addition to others used by my app were jettisoned. Here is how the device logs look: MyAPP <09da004ccd82e7a2c54e0ea6ab4eab24> 1990 (jettisoned) (active) MobilePhon...

ViewController variable release

I added a timer in a VC and when I call the delegate to change the view to another VC I found that the timer is still counting which didnt released as expected - (void)goTitle { NSLog(@"go title"); IPAD03ViewController *vc = [[IPAD03ViewController alloc] initWithNibName:@"IPAD03ViewController" bundle:nil]; [viewController.view removeFr...