[Discuss] segfault with cygwin
John Blomfield
jabfield at shaw.ca
Fri Nov 30 22:03:24 PST 2007
pw wrote:
> John Blomfield wrote:
>>> 2 [main] sh 1780 _cygtls::handle_exceptions: Error while
>>> dumping state (probably corrupted stack)
>>> Segmentation fault (core dumped)
>>>
>> I don't know anything about cygwin but this appears to be an
>> exception error "thrown" by the program due to trying to access a
>> part of memory that is not defined. Usually happens when you exceed
>> the bounds of a defined memory area e.g. an array of bytes or refer
>> to an address that is not allocated. Probably a bug in cygwin or you
>> have written something in bash script that writes stuff where you
>> shouldn't.
>>
>> John Blomfield
>>
>
> I'm not sure how I am writing to memory that I shouldn't.
> I'm using all the standard tools; sed, awk, cut, sort...
>
> There's no custom code or programs just bash stuff.
>
> I was thinking that it could be a memory leak in
> one of the bash utilities.
>
I don't think its a memory "leak", which usually means that you allocate
more and more memory without deleting unused memory, since that usually
just slows execution down as more and more virtual memory on hard drive
is used. Segmentation errors occur when you try to step outside the
address space allocated to your process, Linux stops you doing this,
catches the error and throws an exception. Unlike some OS's which used
to allow you to overwrite program space or system areas and crash the
whole system.
John
> For example, the script iterates through all the lines (430 lines)
> in each file and selects only a few columns from each line
> (using 'cut'). The script also uses awk to detect an unwanted value
> in one field and then excludes that line from the output.
>
> There are 156 files in all so if the script reads something like:
>
>
> for FILE in `cat file_list.txt`;do
> OUT_FILE=`echo $FILE| awk '{print $0 ".out"}'`;
> for LINE in `cat $FILE| sed -e "s/\"//g"| cut -d "|" -f
> 2,4,7,9,10,11,12,13`;do
> ALARM=`echo $LINE| awk -F "|" '{print $3}'`
> if [ "$ALARM" != "gotcha" ]; then
> echo $LINE >> $OUT_FILE;
> fi
> done
> done
>
>
> I wonder how much memory gets used due to bash
> doing everything in memory before actually
> outputting anything....
>
> Peter
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>
More information about the Discuss
mailing list