#278 machine freezes when running astyle in a bash loop


I am running this bash loop to indent a whole project using astyle --

files=`find . -name "*.java"` ;
count=0 ;
for file in $files ; do 
    echo $count: formatting $file ; 
    astyle --style=allman --indent=tab $file ;

when I do this, astyle can format upto 350~ files, then my machine freezes and after a while I get some bad_malloc type errors on a OS dialogue box.

to reproduce, use the above bash script to indent the source codes of this project -- http://code.google.com/p/mason/


  • Jim Pattee

    Jim Pattee - 2014-04-17

    This doesn't fail on my computer.
    What is the last file processed?
    Does it fail when the files are input directly to astyle without the 'find'?
    What is the last file processed with the direct input?
    What OS are you using?
    What astyle version are you using?

    • chudur-budur

      chudur-budur - 2014-04-17

      Hi, I got what was the problem, someone put two empty .java files in one of the folders and whenever astyle encounters an empty file it freezes (and after a while it freezes the whole machine !). Is this a bug? I am not sure. However, now in my bash script I am checking for file emptyness and ignoring them. Thanks anyway !

      Last edit: chudur-budur 2014-04-17
    • chudur-budur

      chudur-budur - 2014-04-17

      and my astyle version is 2.01 and I am using Ubuntu 12.04.4 LTS.

  • Jim Pattee

    Jim Pattee - 2014-04-27
    • status: open --> closed-invalid
    • assigned_to: Jim Pattee
    • Priority: 5 --> 7

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks