What is solution for this error?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What is solution for this error?
# 15  
Old 04-28-2013
Thank you..

have a look on attachment.. physical memory increases rapidly as soon as I execute script but I didn't find rapid change in swap memory..

my friend has 3 GB RAM intel core I3 system(Sony), in which my script works perfectly, but unfortunately I have 4 GB RAM core I5 processor(Dell) getting memory error for just 890MB file processing Smilie

Waiting for help .......

Code:
free | grep 'Swap' | awk '{t = $2; f = $4; print (f/t)}'
0.829798
grep SwapFree /proc/meminfo | awk '{print $2}'
6433152

What is solution for this error?-cpu_usagepng

Last edited by Akshay Hegde; 04-28-2013 at 11:46 AM.. Reason: to attach system usage information
# 16  
Old 04-28-2013
Quote:
Originally Posted by alister
It's used by quite a lot of people, even if they don't realize it. mawk is the default AWK on debian and its derivatives (ubuntu, mint, etc).
with this thread as a result. Smilie
Quote:
mawk changelog:
Code:
20121129
...
	+ add systime and mktime functions

I am not evangelizing; I am simply mentioning some facts that may be of interest.
Interesting.
# 17  
Old 04-28-2013
Quote:
Originally Posted by Akshay Hegde
Thank you..

have a look on attachment.. physical memory increases rapidly as soon as I execute script but I didn't find rapid change in swap memory..
Well, we haven't seen your script, so we can't even guess why it's using such huge gobs of memory...
Quote:
my friend has 3 GB RAM intel core I3 system(Sony), in which my script works perfectly, but unfortunately I have 4 GB RAM core I5 processor(Dell) getting memory error for just 890MB file processing Smilie
Is your system 32-bit or 64-bit? A 32-bit system has limitations on the memory one process can use no matter how much total it has. A 64-bit system does not.
# 18  
Old 04-29-2013
Thanks corona I have
Code:
32-bit OS

I had posted code in
Code:
#11

I just tried to update field of array being used
In my pc vmware Player is installed but while running script I always quit vmware, and then apache tomcat is running , tomcat starts when pc boots (rc.local), whether these two applications interrupting my script to execute ?

But I didn't understand, why its not using swap properly..it has 8Gb of swap memory
# 19  
Old 04-29-2013
Here comes an opinion. I think maybe you're barking up the wrong tree. Smilie You've got a program that consumes several GB of RAM when running. If it was something I had control over, I would go about re-engineering the program. Just my honest opinion.

The code looks pretty "complex" to me, not something I would want to try maintaining. I have to assume the program is producing correct results. If that is not known for sure, that would be even more reason to re-engineer the program.
# 20  
Old 04-29-2013
Quote:
Originally Posted by Akshay Hegde
I am using 3 dimensional array in which 11 functions are there...total 3 files I am using of size 20kb, 890MB,50kb

after the execution of each function one field will be increase, and finally I will write to file

here is my code...

pls corona and hanson give me some solution ..otherwise I have to split file and then I have to use, splitting file is time consuming

I have planned to store msg in separate array and then print at the end, if works then I will be very happy

Code:
awk 'FNR==1{i++}

                                   {LNC[i]=NF}
                                   {for(k=1;k<=NF;k++)A[i,FNR,k]=$k}
                                   {LC[i]=FNR}

function Step1(){   
                            w=1
                            for(i=1;i<=LC[2];i++)
                
                            if(A[2,i,2]<A[2,i+1,2])
                              {
                               PT[2,i,1]=w
                               for(m=1;m<=LNC[2];m++)
                               PT[2,i,m+1]=A[2,i,m]
                              }
             else
                             {
                              PT[2,i,1]=w++
                              for(m=1;m<=LNC[2];m++)
                              PT[2,i,m+1]=A[2,i,m]
                             }
                 }

function Dup_C(){

                               for(i=1;i<=LC[2];i++)
            
                                        if(PC[2,i,3]==PT[2,i+1,3] && PT[2,i,2]==PT[2,i+12])
                                                  PT[2,i,LNC[2]+nt]="DUPLICATE"
                                        else
                                                   PT[2,i,LNC[2]+nt]="00"

                             }

# Write to file finally here
function out(){
                                    for(i=1;i<=LC[2];i++)
                                     {                
                                          for(m=1;m<=LNC[2]+2;m++)
                                                   printf "%s%s",PT[2,i,m],OFS >>"QC.dat"
                                                   printf "\n" >>"_QC.dat"
                                     }
                   }

                      END{
                                   Step1()
       
                                   Dup_C()

                                   out()
                        }' OFS=\\t file1 file2 file3 ..

I thought the indentation on your code hard made it hard to follow what was going on and tried copying and reformatting your code to see if I could understand what it was doing. I wasn't successful in figuring out what you're doing, but I did notice that one of your references to your 3-dimensional array only has 2 dimensions. My reformatted version of your code follows with what I believe is a missing comma added in red. You also have two references the the variable nt that I marked in orange below because you never set a value for nt and I don't see any reason to add 0 to these values at this point.

It also seems strange that you're writing most of your data to a file named QC.dat, but the newlines separating output lines are written to a different file named _QC.dat???

Of course, the reason for adding nt and for having two output files might be obvious if we understood what the other 8 functions that you haven't shown us are doing. Smilie

Code:
awk '
function Step1() {  
        w=1
        for(i=1;i<=LC[2];i++) {
                if(A[2,i,2]<A[2,i+1,2])
                        PT[2,i,1]=w
                else    PT[2,i,1]=w++
                for(m=1;m<=LNC[2];m++)
                        PT[2,i,m+1]=A[2,i,m]
        }
}
function Dup_C() {
        for(i=1;i<=LC[2];i++)
                if(PC[2,i,3]==PT[2,i+1,3] && PT[2,i,2]==PT[2,i+1,2])
                        PT[2,i,LNC[2]+nt]="DUPLICATE"
                else    PT[2,i,LNC[2]+nt]="00"
}    
# Write to file finally here
function out() {
        for(i=1;i<=LC[2];i++) {      
                for(m=1;m<=LNC[2]+2;m++)
                        printf "%s%s",PT[2,i,m],OFS >>"QC.dat"
                printf "\n" >>"_QC.dat"
        }
}  
FNR==1 {i++}
{       LNC[i]=NF}
{       for(k=1;k<=NF;k++)
                A[i,FNR,k]=$k
}
{       LC[i]=FNR}
END { 
        Step1()
        Dup_C()
        out()   
}' OFS=\\t file1 file2 file3 ..

If you would show us what the input data files look like and show us a corresponding example of the output you want, we might be able to help. But, with only one comment in your code and no sample input and output, you are again asking us to guess at what you're doing and why you're trying to do it while tying our hands behind out backs. Smilie
# 21  
Old 04-29-2013
I am sorry Don Cragun I did typing mistake I just came to know, please have a look on updated code..in
Code:
 #11

actually what I want to achieve is after the end of each function I want to write some message depending on condition specified in function...and at the end with another function I want to write to file.
it works if I split file, but for file with huge size I facing problem .
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Ubuntu

What is solution for this error "tar: Exiting with failure status due to previous errors"?

Does anyone know what is solution for this error ?tar: Exiting with failure status due to previous errors from last 3 days I am trying to take backup of home/user directory getting again and again same error please anyone give me solution (8 Replies)
Discussion started by: Akshay Hegde
8 Replies

2. Shell Programming and Scripting

need the solution

Write a program to print all prime numbers from 1 to 300. (3 Replies)
Discussion started by: paniruddha
3 Replies
Login or Register to Ask a Question