memory

Is there a way to instruct Eclipse to off-load memory when minimized?

i use eclipse with lot of plug-ins and will have more than one windows open at a time, and the memory usage is huge and my system hangs most of the time. In FireFox we can set the flag config.trim_on_minimize=true and whenever FireFox is minimized the RAM Memory usage is reduced. (ie swapped), i am wondering is there any option in eclip...

Getting a seg fault, having trouble with classes and variables.

Ok, so I'm still learning the ropes of C++ here so I apologize if this is a simple mistake. I have this class: class RunFrame : public wxFrame { public: RunFrame(); void OnKey(wxKeyEvent& keyEvent); private: // Configuration variables. const wxString *title; const wxPoint *origin; const wxSize *size; const...

memory management objective c - returning objects from methods

Hi, Please clarify, how to deal with returned objects from methods? Below, I get employee details from GeEmployeetData function with autorelease, 1. Do I have to retain the returned object in Process method? 2. Can I release *emp in Process fucntion? -(void) Process { Employee *emp = [self GeEmployeetData] } +(Employee*) GeEmploye...

Windows Service HTTPListener Memory Issue

Hi all, Im a complete novice to the "best practices" etc of writing in any code. I tend to just write it an if it works, why fix it. Well, this way of working is landing me in some hot water. I am writing a simple windows service to server a single webpage. (This service will be incorperated in to another project which monitors the ser...

C++ destructor issue with std::vector of class objects

I am confused about how to use destructors when I have a std::vector of my class. So if I create a simple class as follows: class Test { private: int *big; public: Test () { big = new int[10000]; } ~Test () { delete [] big; } }; Then in my main function I do the following: Test tObj = Test(); vector<Test> tVec; tVec...

C++ pointers simple question

If I have the following lines inside a loop: Type *unite = new Type(newSize); or double *array= new double[anySize]; what is the behavior in what concerns to memory if I don't have delete operators inside it? It will be constantly allocating objects and arrays on different memory locations, and therefore memory leaks? ...

Why do dicts of defaultdict(int)'s use so much memory? (and other simple python performance questions)

I do understand that querying a non-existent key in a defaultdict the way I do will add items to the defaultdict. That is why it is fair to compare my 2nd code snippet to my first one in terms of performance. import numpy as num from collections import defaultdict topKeys = range(16384) keys = range(8192) table = dict((k,defaultdict(i...

alignment and granularity of mmap

I am confused by the specification of mmap. Let pa be the return address of mmap (the same as the specification) pa = mmap(addr, len, prot, flags, fildes, off); In my opinion after the function call succeed the following range is valid [ pa, pa+len ) My question is whether the range of the following is still valid? [ rou...

iPhone app works hundreds of times, then crashes from memory error on startup, then never works until restart - why?

I have a Cocos2d/openGL iPhone game. It's a universal app and I'm dealing with an occasional but nasty error on the iPad. We are loading a lot of textures up front (3 2048x2048 textures). I'm working on reducing this up front load, but what worries me is I really don't understand the root cause of this crash that permanently breaks th...

Memory not being freed, causing giant memory leak

Unfortunately the solutions have not worked yet; setting result.values pointer to 0 doesn't actually relieve the memory usage. I've also tried free(result.values) in place of that, but that is not desired as that deletes my string. Edit 2: I'll try writing a stack destructor. Edit 3: Gotcha. Thanks DeadMG, writing a destructor that fre...

Monitor memory usage of child process

I have a Linux daemon that forks a few children and monitors them for crashes (restarting as needed). It will be great if the parent could monitor the memory usage of child processes - to detect memory leaks and restart child processes when the go beyond a certain size. How can I do this? ...

jQuery to store data for sessions

I am trying to use jQuery AJAX. What my requirement is, i wish to load user names from DB in dataset, convert it to JSON format and store it in memory or using jQuery data for use while a user is browsing my site, i.e for a session. This way I can use autocomplete or my own code to display data to user. Can anyone help me design such a ...

how free of memory happen in this case???

#include <stdio.h> void func(int arr[],int xNumOfElem) { int j; for(j=0; j<xNumOfElem; j++) { arr[j] = j + arr[j]; printf("%d\t",arr[j]); } printf("\n"); } int main() { int *a,k; a = (int*) malloc(sizeof(int)*10); for(k = 0; k<10; k++) { a[k] = k; printf("%d\t",a[k]); ...

Java native memory usage

Hi All, Is there any tool to know how many native memory has been used from my java application ? I've experienced outofmemory from my application : Current setting is : -Xmx900m Computer, Windows 2003 Server 32bit, RAM 4GB. Also is changing boot.ini to /3GB on windows, will make any difference? If is set Xmx900m, how much max nati...

C++ static array leading to memory leak?

Lets say I have something like... void foo() { char c[100]; printf("this function does nothing useful"); } When foo is called, it creates the array on the stack, and when it goes out of scope, is the memory deallocated automatically? Or is c destroyed, but the memory remains allocated, with no way to access it/get it back exce...

In C, do braces act as a stack frame?

If I create a variable within a new set of curly braces, is that variable popped off the stack on the closing brace, or does it hang out until the end of the function? For example: void foo() { int c[100]; { int d[200]; } //code that takes a while return; } Will d be taking up memory during the code that takes a ...

ASP.NET loading of DLLs memory usage

I have a web site that has many DLLs in the BIN directory. I know that each of them load when the web site is started. How can I determine how much memory is being used by the loading of these DLLs? Is this the same as cache memory? If so, then that does not make sense since the memory used is VERY low. I need to know how much memor...

Why is address zero used for null pointer?

In C (or C++ for that matter), pointers are special if they have the value zero: I am adviced to set pointers to zero after freeing their memory, because it means freeing the pointer again isn't dangerous; when I call malloc it returns a pointer with the value zero if it can't get me memory; I use if (p != 0) all the time to make sure pa...

Could I ever want to access the address zero?

The constant 0 is used as the null pointer in C and C++. But as in the question "Pointer to a specific fixed address" there seems to be some possible use of assigning fixed addresses. Is there ever any conceivable need, in any system, for whatever low level task, for accessing the address 0? If there is, how is that solved with 0 being ...

C++ std::vector memory/allocation

From a previous question about vector capacity, Mr. Bailey said: In current C++ you are guaranteed that no reallocation occurs after a call to reserve until an insertion would take the size beyond the value of the previous call to reserve. Before a call to reserve, or after a call to reserve when the size is between the value of the ...