How to handle memory error?


 
Thread Tools Search this Thread
Top Forums Programming How to handle memory error?
# 1  
Old 04-20-2005
Question How to handle memory error?

Hi,

I need to know what is the right way of handling out of memory conditions. If a program is not able to dynamically allocate memory (new fails), is it right to wait for some amount of time (say 5 sec) and then try again to allocate memory? Or should we kill the process and again restart it? My process needs to be running continuously. Even if due to some error it has to stop, it should resume action after some time automatically without any manual intervention.

Thanks,
Diganta
# 2  
Old 04-20-2005
It sounds like you have a memory leak - ie., calling new but not delete.

Waiting five or ten seconds will not increase process memory.

Depending on your OS, there are tools to find memory leaks in code. Check out electric fence and valgrind. There are versions of these tools for a lot of different unix-es.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

NFS write error on host xyz: Stale NFS file handle - Solaris 10

Oct 13 12:19:15 xyz nfs: NFS write error on host xyz: Stale NFS file handle. Oct 13 12:19:15 xyz nfs: (file handle: 68000000 1bc5492e 20000000 377c5e 1ce9395c 720a6203 40000000 bdfb0400) Oct 13 12:19:15 xyz nfs: NFS write error on host zyz: Stale NFS file handle. Oct 13 12:19:15 xyz nfs: ... (5 Replies)
Discussion started by: psychocandy
5 Replies

2. Linux

How does the Operating System handle memory?

Hey everyone. Ok, so I know that from inside of any particular program, it see's through virtualized memory, a full range of available memory. It is given the ability then to place variables, data, user input etc, on the Stack, Heap, BSS, or Code segment of it's range. My question is what does the... (5 Replies)
Discussion started by: Lost in Cyberia
5 Replies

3. Shell Programming and Scripting

Handle error

I have a script as below , the script can tar file to the tape , however , it is fail to handle the error , if there is error like the backup file is in writing , then it will echo this is fail ( but the file has successful backup actually , so the backup task is succes , but it still report it is... (6 Replies)
Discussion started by: ust
6 Replies

4. UNIX for Dummies Questions & Answers

Difference between handle to the thread HANDLE and thread identifier pthread_t

This question might be silly but its confusing me a bit: What is the difference between handle to the thread HANDLE and thread identifier pthread_t? ---------- Post updated at 01:52 PM ---------- Previous update was at 01:48 PM ---------- Sorry I saw details and HANDLE is in windows and... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

5. Shell Programming and Scripting

Error PHP Fatal error: Allowed memory size of 67108864 bytes exhausted(tried to allocate 401 bytes)

While running script I am getting an error like Few lines in data are not being processed. After googling it I came to know that adding such line would give some memory to it ini_set("memory_limit","64M"); my input file size is 1 GB. Is that memory limit is based on RAM we have on... (1 Reply)
Discussion started by: elamurugu
1 Replies

6. UNIX for Advanced & Expert Users

Out of Memory error when free memory size is large

I was running a program and it stopped and showed "Out of Memory!". at that time, the RAM used by this process is around 4G and the free memory size of the machine is around 30G. Does anybody know what maybe the reason? this program is written with Perl. the OS of the machine is Solaris U8. And I... (1 Reply)
Discussion started by: lilili07
1 Replies

7. Solaris

memory error

Hi All, I recently patched one of t5120s I have (running solaris 10). I rebooted my system after patching and found following meesage on console, While showfaults in ALOM shows following message: showfaults Last POST Run: Sat Feb 14 05:51:08 2009 How serious is this error and can... (3 Replies)
Discussion started by: upengan78
3 Replies

8. Solaris

NFS write error on host : Stale NFS file handle

:confused:Hi all When i see in the /var/adm/messages, i saw the following error unix: NFS write error on host : Stale NFS file handle. unix: (file handle: 45ca415 3e7 a0000 2c7f6 3ebfc25f a0000 2 3e49) It is using sunOS 5.7. Is anybody know what is this error? Is is related to any network... (2 Replies)
Discussion started by: AirWalker83
2 Replies

9. Solaris

Error Message: find: cannot open /: Stale NFS file handle

I am using the "find" command below and it respond with the error message " find: cannot open /: Stale NFS file handle" what does it mean? what can I do about it? Need advice, thanks. below are the command that I enter, the respond and the error message: root@ScripServer:/# find / -name... (1 Reply)
Discussion started by: ezsurf
1 Replies

10. Shell Programming and Scripting

FTP - To handle error while transferring files

Hi, I had written an FTP script where in I loop through the directories and transfer the files from each and every directory of Windows to UNIX. Now the problem is when 1. The connection is unable to be established I should return some error codes 2. When there is some system... (1 Reply)
Discussion started by: mahalakshmi
1 Replies
Login or Register to Ask a Question