LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 03-11-2005, 10:06 AM   #1
shinni
LQ Newbie
 
Registered: Jan 2005
Posts: 5

Rep: Reputation: 0
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
 
Old 03-11-2005, 10:40 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
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...
 
Old 03-11-2005, 02:00 PM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
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.
 
Old 03-12-2005, 08:04 AM   #4
shinni
LQ Newbie
 
Registered: Jan 2005
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 03-12-2005, 09:25 PM   #5
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
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?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard Input in Perl Program eachow Linux - General 2 11-17-2005 12:16 AM
how to show input and output of a program on the terminal divin Linux - Software 1 03-25-2005 12:19 AM
An easy way to remove large program groups? KneeLess Debian 6 03-15-2004 08:17 AM
Help me! How to program input laguage support application iceface Programming 1 02-04-2004 11:41 PM
a program to record audio input matt_w_lambert Linux - Software 4 04-27-2003 03:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:27 PM.

Contact Us - Advertising Info - Rules - Privacy - Donations - Contributing Member - LQ Sitemap - "Weather apps tell you it'll rain. Wyndo tells you when to go."
Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions