0
голосов
1ответов
406 просмотров

ORO (One Reference Only) Memory Management

What do you think about the concept of using ORO instead of traditional Garbage Collecting? It doesn't seem to be widely adopted, and is more or less argumentative, but it can provide these benefits as I know: Synchronous execution of code: your program will always take known amoun of time to e...

28
голосов
7ответов
58584 просмотров

Memory usage of current process in C

I need to get the memory usage of the current process in C. Can someone offer a code sample of how to do this on a Linux platform? I'm aware of the cat /proc/<your pid>/status method of getting memory usage, but I have no idea how to capture that in C. BTW, it's for a PHP extension I'm mo...

17
голосов
2ответов
26366 просмотров

How to reduce Netbeans' memory usage?

When using netbeans to edit a PHP project, the IDE can (over time) use 400+ MB of memory. Is there any way to turn off certain features or other tricks to reduce its memory usage?

1
голосов
1ответов
578 просмотров

To retain or not to retain

If I am adding an item to a dictionary like this: [connectionHandlers setObject:projectsHandler forKey:[NSNumber numberWithInt:PROJECTS_CONNECTION_ID]]; Should I be retaining the NSNumber used for the key. Also, when an object is added to an NSArray or NSDictionary, is it retained by the Arra...

3
голосов
3ответов
556 просмотров

deleting char ** correctly?

I've created a 2d array of c-strings using : char ** my_array = new char*[N]; and then I initialized each row using : my_array[i] = new char[M]; // where M is a varying number. assign values to my_array[i] later So I pretty much got a jagged 2d array. I wanted to proceed and delete the who...

8
голосов
7ответов
3098 просмотров

Shared pointers and the performance

I have been using shared pointers for soem time now, and I have performance issues in my program... So I'd like to know if shared pointers lead to performance decrease. If so, then how hard? Thanks alot. My program is multi-threaded, using std::tr1::shared_ptr

45
голосов
6ответов
11277 просмотров

Is delete[] equal to delete?

IP_ADAPTER_INFO *ptr=new IP_ADAPTER_INFO[100]; if I free using delete ptr; will it lead to memory leak, if not then why ? This is disassembly code generated by VS2005 ; delete ptr; 0041351D mov eax,dword ptr [ptr] 00413520 mov dword ptr [ebp-0ECh],eax 00413526 mov ...

12
голосов
5ответов
19214 просмотров

How can I get the total physical memory in C#?

I am using the GlobalMemoryStatusEx function to retrieve information about memory, but this function doesn't work correctly. It returns 0 for all properties. I don't think this function works in my Windows 7 environment. [StructLayout(LayoutKind.Sequential)] internal struct MEMORYSTATUSE...

1
голосов
3ответов
88 просмотров

Declaring and releasing objects efficiently, object level or local to a method?

Is there a reason, other than as may be required by object scope across different methods of the object, to use an object like this: @interface ... ViewMgmtAppDelegate : NSObject <UIApplicationDelegate> { Obj *obj1; ... } @end @implementation - (void)applicationDidFinishLaunching:(UIAppli...

22
голосов
9ответов
14853 просмотров

Why would you ever want to allocate memory on the heap rather than the stack?

Possible Duplicate: When is it best to use a Stack instead of a Heap and vice versa? I've read a few of the other questions regarding the heap vs stack, but they seem to focus more on what the heap/stack do rather than why you would use them. It seems to me that stack allocation would a...

3
голосов
4ответов
7271 просмотров

How can I find out how much memory my c++ app is using on the Mac

Certain operations in my app are using more memory than I think they should, and I would like to log the current memory usage to help identify which they are. Is there a system call that will return the amount of memory currently in use?

2
голосов
2ответов
1125 просмотров

Debug build works beautifully, ad hoc build crashes hard

I'm working with the EXIF library at http://code.google.com/p/iphone-exif/ and I have come across a real head scratcher of a bug. When I implement the library in a debug build everything works beautifully, but when I compile for ad hoc beta testing the app crashes hard. I'm getting the follow...

1
голосов
1ответов
1765 просмотров

WPF with GDI Memory growth

I'm writing an app in WPF (C#) that plots certain types of fractals. The data sets are 3d points and need to represented as single pixels. The user can click and drag to rotate the plots The amount of points varies but can be quite large (five million plots or more). Currently I am drawing on...

4
голосов
3ответов
1818 просмотров

C++ Initialization list and memory alloc

Is the following valid? class myClass { private: ... int m_nDataLength; boost::shared_array<int> m_pData; ... public: myClass(): ..., m_nDataLength(10), m_pData(new int[m_nDataLength]), ... { } } Am I right in assuming that the initialization wil...

6
голосов
1ответов
911 просмотров

OutOfMemoryError in a separate Java thread

Consider that I have a main Thread which executes a new Runnable in a new Thread. Now, while the new Thread is executing, the Java VM runs out of memory and throws an OutOfMemoryError. What happens? Does the target thread stop? Will the main thread continue? When the new Thread crashes, will the...

14
голосов
6ответов
6361 просмотров

Does std::vector.pop_back() change vector's capacity?

If I allocated an std::vector to a certain size and capacity using resize() and reserve() at the beginning of my program, is it possible that pop_back() may "break" the reserved capacity and cause reallocations?

8
голосов
11ответов
7368 просмотров

String capitalize - better way

What method of capitalizing is better? mine: char[] charArray = string.toCharArray(); charArray[0] = Character.toUpperCase(charArray[0]); return new String(charArray); or commons lang - StringUtils.capitalize: return new StringBuffer(strLen) .append(Character.toTitleCase(str.char...

11
голосов
2ответов
16468 просмотров

Static allocation vs. Dynamic allocation vs. Automatic allocation

What are the differences among static, dynamic, and automatic allocation?

0
голосов
2ответов
66 просмотров

Whats the memory managment perspective on this?

I am checking Day objects in my schedule Dictionary and want to know what to do about the Day pointer when I'm done. Build and Analyze doesn't complain about it, but it just sits there taunting me. I feel like it's just sitting there when the function finishes and maybe even a new one gets create...

1
голосов
2ответов
254 просмотров

DataGridViewRow not being Garbage Collected

I have a DataGridView being regularly populated via data-bound objects, and the number of rows can potentially become large, say many thousands during a 'logging cycle'. When a new 'logging cycle' begins, the grid is cleared because the underlying datasource is cleared and the process begins aga...

3
голосов
1ответов
1151 просмотров

UIImage Memory problems because of caching

I googled for the memory issue associated with UIImage and came across many threads talking about the problem but no real help or solution. I know when we use -imageNamed: the object is being cached so it's better to use initWithData:. When we use drawRect: and UIGraphicsGetImageFromCurrentImage...

11
голосов
4ответов
6350 просмотров

Incrementally building a numpy array and measuring memory usage

I have a series of large text files (up to 1 gig) that are output from an experiment that need to be analysed in Python. They would be best loaded into a 2D numpy array, which presents the first question: As the number of rows is unknown at the beginning of the loading, how can a very large num...

1
голосов
2ответов
1069 просмотров

iPhone app: recover view after didReceiveMemoryWarning

The app in question has a MainView->ModalView pair. The ModalView is shown via UIModalTransitionStyleFlipHorizontal. In case of didReceiveMemoryWarning, MainView is dumped (since it is not visible) and the app stays "alive" but when you flip back there is a (very) short period of time when the...

34
голосов
13ответов
53418 просмотров

Memory overhead of Java HashMap compared to ArrayList

I am wondering what is the memory overhead of java HashMap compared to ArrayList? Update: I would like to improve the speed for searching for specific values of a big pack (6 Millions+) of identical objects. Thus, I am thinking about using one or several HashMap instead of using ArrayList. But...

1
голосов
3ответов
634 просмотров

Where hardcoded values are stored?

For an investigation i need to know where hard-coded values are stored. Question : A function having hard-coded values inside it , and this function is called by many threads at same time , is there any chance that that hard-coded value will be corrupted. For example : myFunc is called by many ...

5
голосов
1ответов
2364 просмотров

NumPy and memmap: [Errno 24] Too many open files

I am working with large matrixes, so I am using NumPy's memmap. However, I am getting an error as apparently the file descriptors used by memmap are not being closed. import numpy import tempfile counter = 0 while True: temp_fd, temporary_filename = tempfile.mkstemp(suffix='.memmap') ma...

2
голосов
3ответов
626 просмотров

Page File Usage

I run a script which does text manipulation on the files system. The script runs on text files ( .h, .cpp ). As the script runs i see that the PF usage increases up until it reaches the amount of VM allocated for the page file. Is there a way to flush the VM during the run or after it? I have...

3
голосов
4ответов
940 просмотров

OUT OF MEMORY only when virtual limit is hit?

As I know in win32 every program receives say 4GB of virtual memory. Memory manager is responsible for offloading chunks of memory from physical memory to disk. Does it imply that malloc or any other memory allocation API will throw OUT_OF_MEMORY exception only when virtual limit is hit? I mea...

7
голосов
4ответов
2102 просмотров

What is the best solution to replace a new memory allocator in an existing code?

During the last few days I've gained some information about memory allocators other than the standard malloc(). There are some implementations that seem to be much better than malloc() for applications with many threads. For example it seems that tcmalloc and ptmalloc have better performance. I ...

22
голосов
3ответов
6853 просмотров

Javascript memory management pitfalls?

I know that Javascript has a garbage collector. Therefor, using delete remove only a reference to the object, and when there is no more reference to this object, it is deleted by the GC. Javascript is tricky, with the closures, the fuzzy name space and the prototype inheritance, it's not always ...