Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-11-2005, 10:06 AM
|
#1
|
|
LQ Newbie
Registered: Jan 2005
Posts: 5
Rep:
|
Program gets aborted on large input
Hi All,
I am facing problem while i execute one C program on large input files. The program is running correctly, there is no segmentation fault. But after time (around 56-60 sec:- as shown in 'top' command) the program is getting aborted automatically. When i ran the command 'top', i could see that root executes the process kswapd (pid=9) many times till my a.out gets stopped..
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAN
6245 shinni 24 0 284m 170m 2156 R 73.9 68.1 0:57.60 a.out
9 root 15 0 0 0 0 D 0.7 0.0 0:00 .53 kswapd0
I tried several inputs, but when the time is exceeds the above specified threshold, the program gets aborted automatically.. is there any system varibale i can configure so that i can run and check the programs for any period of time I want ? System becomes very slow when i run the program ? Why system kills the process automatically ? I was running the program , using KDE desktop theme and there were no other forground processes. OS is Fedora core 3. RAM is 256 MB. What alternatives I shall try to solve this ?
Is the program is getting aborted because of insufficient swap memory space, what shall i do ?
Please help.
Regards
Shinni
|
|
|
|
03-11-2005, 10:40 AM
|
#2
|
|
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536
Rep: 
|
Maybe your program has a memory-leak, i.e.trying to eat up all memory after a while.
The Linux kernel has a mechanism for killing processes when it runs out of memory ("OOM-killer" - "Out-Of_Memory-Killer"). Maybe it's the OOM-killer that kills your program...?
Without the code of your program, we need to guess...
|
|
|
|
03-11-2005, 02:00 PM
|
#3
|
|
Member
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557
Rep:
|
First question would be whether the program is *supposed* to use a ton of ram. Clearly the best thing you can do is to either fix the memory leak or change your algorithm so it doesn't push you heavily into swap at all.
I want to say that on most distros, simply having a large enough swap space will keep your program from being terminated. You might want to play around with ulimit and see if your per-process memory usage is limited.
|
|
|
|
03-12-2005, 08:04 AM
|
#4
|
|
LQ Newbie
Registered: Jan 2005
Posts: 5
Original Poster
Rep:
|
Re: Program gets aborted on large input
I tried using the hard limits for stack space ( ulimit -s unlimited) , to get the available stack space ..
From another forum , i got a suggestion to create temporary stack file of some particular size and run the program. But the program was using the memory from default stack space, thought new stack file was created..
what shall i do to attach exe file and commands i tried ? I'm not allowed to set attachments here..
The input file is not large, but there is lot of recursion using each substring from the input file.
Both the above methods did not work , program is still getting aborted. When I increase stackspace using ulimit , program is running for soem mroe time ..
It was my guess that the program is getting aborted because of in-sufficient memory. It is not showing any segmentation fault , and if the input is given part by part , it is working .
Thank you for time
|
|
|
|
03-12-2005, 09:25 PM
|
#5
|
|
Member
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557
Rep:
|
if you can feed the program its input "part by part", it should probably not be reading the whole file into memory in the first place : ) Are you sure you can't adjust so that it doesn't?
|
|
|
|
All times are GMT -5. The time now is 06:27 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|