memory

Memory for specific program on iPhone

Hi, it is possible on the iPhone to get the memory consumption for a specific program? For example, I want to know how many memory my program is used without using the instrument tool. Thanks in advance. Alex ...

How can I debug a possible memory leak in a Perl CGI script?

I have a legacy Perl CGI page running on Apache that processes a large Excel spreadsheet worth of data, adding to the database as necessary. It gets processed in groups of data, and each group of data gets sent to the database. After each call to the database, my system's available memory decreases significantly to the point where there...

Multithreaded Heap Management

In C/C++ I can allocate memory in one thread and delete it in another thread. Yet whenever one requests memory from the heap, the heap allocator needs to walk the heap to find a suitably sized free area. How can two threads access the same heap efficiently without corrupting the heap? (Is this done by locking the heap?) ...

Need some help understanding pointers and memory in C

I'm writing a bit of code for a class, but since I have no experience in C I'm a bit unsure of what the code I've written actually does. Particularly what the memory looks like. Here's the relevant bits: typedef struct listnode *Node; typedef struct listnode { void *data; Node next; Node previous; } Listnode; typedef struct...

Cygwin memory problem, only swap is being used?

Hi, I am porting a rails application to Win2K3 server, with cygwin. The application is up and running, but start to respond slowly very soon. I find that cygwin is only allocating swap to all process ( with top ), not using the 2GB memory available. Even Windows Task Manager shows high CPU usage but lots of free memory. How can I track...

Efficiently counting the number of lines of a text file. (200mb+)

Hello all, I have just found out that my script gives me a fatal error: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 440 bytes) in C:\process_txt.php on line 109 That line is this: $lines = count(file($path)) - 1; So I think it is having difficulty loading the file into memeory and counting the ...

create private var yada:Whatever; depending on xml count

I am trying to declare private variables that will be used elsewhere in my flex mxml main application. But I need to only create the variables when their is an equal number in my xml file. My xml snippet looks like this: <POIs> <location> <name>jane</name> <lat>12345</lat> <long>12345</long> ...

help with linked lists implementation

Hi, I'm trying to make a Stack using an underlying linked list structure. Maybe I'm wrong, but I'm having trouble with the remove() function. int Stack::remove(){ node* victim = new node; int popped; popped = top->element; victim = top; top = victim->next; delete victim; return popped; } I'm getting glibc ...

What does C(++) do with values that aren't stored in variables?

I'm a bit curious about how C and C++ handle data which isn't stored in variables, e.g: int IE6_Bugs = 12345; int Win_Bugs = 56789; Yeah - everything clear. IE6_Bugs has 123456 stored at it's specific memory address. Then what about.. if ( IE6_Bugs + Win_Bugs > 10000 ) { // ... So C grabs the values of the two variables and adds...

Should I cache document.getElementById() in a variable or call it everytime?

I'm having a lot of elements which are generated and referenced (mouseover, clicks, position changes) a lot of times. I have the ID's of those elements at hand. Is it wise to store the document.getElementById(ID) calls in a variable, or is it faster/just as fast/slower to call document.getElementById() everytime? var app = []; var app....

What does Java look like in memory

Hey, I am new to java and still learning. I got my head around inner and anonymous classes. Now I have a technical question about how java looks like in memory, when allocating objects, defining classes, etc. Like what does memory look like when I have a field that is an object that is defined in an outside class vs an inner class. ...

C++ Questions: pointers/memory addresses and subclasses

Why are we allowed to run this code: int* FunctionB(int x) { int temp =30; //more code return &temp; } It seems to me that I am not returning what I said I would. Why is it that a memory address can be returned if I declared the return type to be a pointer. Isn't a pointer something that points to a memory address, not...

bad_alloc in detail?

Hi, I work on a game project. Recently, we run into a problem which we catch a "bad_alloc" exception when we load/unload different scenes for about three times. Eachtime we load a scene, we first load the compressed .zip folder into the memory and then extract game objects from it. Since we don't have any memory profiler tool, I simply...

Can Large Python Scripts Drain DiskSpace?

UPDATE: Interestingly, after almost 15min, I seem to have AUTOMATICALLY restored about 500MB. Hows this happening? I'm on Mac OSX 10.5.6(Leopard). I wrote a python script for a Project-Euler problem. My script had a loop which iterated for an enormous count like 600851475143. Used Vi and Python on Mac's Terminal. I didn't get the resu...

C stdlib realloc issue

The realloc reference says: The function may move the memory block to a new location, in which case the new location is returned. Does it mean that if I do this: void foo() { void* ptr = malloc( 1024 ); unsigned char* cptr = ( unsigned char* )ptr+256; ptr = realloc( ptr, 4096 ); } then cptr may bec...

Freeing a character pointer

I have a function which is called multiple times during the program's execution. In said function, I have a dynamic character pointer which I resize numerous times. My question is: do I need to free this pointer before the end of the function? void functionName() { char *variable = (char *) malloc(0); //variable is resized with re...

What is the difference Between Assignment and Creating Instance of String?

In an interview question, Interviewer asked me What is the common and difference between the following statements: String s = "Test"; String s = new String("Test"); Is there any difference in memory allocation? ...

Why is my application pool having memory usage spikes?

I hosted my application in production. Within 5 to 6 hours the application pool spikes and uses more memory? What application objects or system objects are stored in the application pool? ...

Is there a way to share an in-memory object between multiple websites?

Hi all We have about 70 sites on our server that use same application (with different Application Pools) and they use for example a shared skin file. So is there a way to load this file to memory and share for all applications? what I mean is to sharing cache in multiple websites to decrease pressure on server. Thanks in advance ...

what is the difference between small memory model and large memory model ?

what difference does it make when i choose 'large memory model' instead of 'small memory model' inside Turbo C compiler ? how does that change behavior of my program ? regards, essbeev. ...