Sponsored Content
Full Discussion: Help with script
Top Forums Shell Programming and Scripting Help with script Post 302814613 by bakunin on Wednesday 29th of May 2013 08:00:13 PM
Old 05-29-2013
You read in the whole file into memory here:

Code:
A[++c] = $1

It is natural outcome of a limited resource like memory, that, as the files grow larger, at some point this memory is exhausted. What follows is the allocation error you see.

Try to use a less memory-intensive algorithm.

I hope this helps.

bakunin
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

5. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
nmadvise(3)						     Library Functions Manual						       nmadvise(3)

NAME
nmadvise - Advise the system of the expected paging behavior of a process (libnuma). SYNOPSIS
#include <numa.h> #include <sys/nman.h> int nmadvise( void *addr, long len, int behav, memalloc_attr_t *attr ); PARAMETERS
The parameters to the nmadvise() function are the same as for madvise(), with the addition of the attr parameter: Points to the starting address of one memory region, or a list of starting addresses and lengths for multiple regions, to which the advice refers. If a positive value, specifies the length, in bytes, of one region starting at the address specified by the addr parameter. If a negative value, specifies that the addr parameter points to an array of regions (an array of starting addresses and their lengths). In this case, -len indicates the number of regions in the array. See the description of the nmemalloc_range_t type in numa_types(4) for more information about the type used for array elements. Specifies the behavior of the region. See DESCRIPTION for details. Points to a structure containing the memory allocation policy and attributes that will be assigned to the region or regions specified by the addr and len parameters. DESCRIPTION
The nmadvise() function permits a process to advise the system about its expected future behavior in referencing a mapped file or shared memory region. The nmadvise() function supports the following flags for the behav parameter, in addition to those documented in madvise(2): Prepare the specified range or object for migration to the memory regions specified by the memory allocation policy attributes. Without this flag, only new allocations occur from the regions specified by the new allocation policy attributes. This flag may be logically ORed with the MADV_CURRENT flag to indicate that the application should wait for migration to occur. Without this flag, the nmadvise() function may return before all of the pages in the range have been migrated or replicated, subject to resource availability. If the requested resources are not available, the function will terminate when the resources are exhausted. See MADV_INSIST. When used in conjunction with MADV_WAIT, when the requested resource is exhausted, the remaining memory will be paged out to the backing store. If, in the structure pointed to by attr, the mattr_policy member is MPOL_DIRECTED and the mattr_rad member is RAD_NONE, the mattr_radset member specifies the set of Resource Affinity Domains (RADs) where the pages of the specified range will be allocated. If the mattr_radset member is NULL, the system will select a RAD for the memory object from among all of the RADs in the caller's parti- tion. In this case, the overflow set will be NULL. If the attr parameter is NULL, any behav flags specific to nmadvise()are ignored, and the function is equivalent to madvise(). NOTES
As with madvise(), the behaviors specified with nmadvise() are considered by the system to be hints, and may in fact, be unimplemented. Unimplemented behaviors will always return success. RETURN VALUES
Success. Failure. In this case, errno is set to indicate the error. ERRORS
If the nmadvise() function fails, it sets errno is set to one of the following values for the reason specified: A non-NULL attr argument points to an invalid address. The behav parameter is invalid. The structure pointed to by the attr argument contains an invalid memory allocation policy, an invalid RAD, or an invalid RAD set. The behav parameter specifies MADV_SPACEAVAIL, and resources cannot be reserved. SEE ALSO
Functions: madvise(2), nmmap(3), numa_intro(3) Files: numa_types(4) nmadvise(3)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy