On 02/11/2011, at 7:11 PM, john skaller wrote:

> 
> Scanning judySL array 0x100100640->0x10030db50
> actually collected 612940 objects, still allocated 192964 bytes
> d=build/release/tut/tutorial/tut-01.01-0
> Segmentation fault


Well now I don't know what to do. This is flx_cp analysing all the files on my 
Desktop
and down .. that's a LOT of files. As you can see, half a million objects are 
collected
each time by the GC .. manually checking anything is out of the question.


This bug is occurring in flx_ls too:

~/felix>FLX_REPORT_COLLECTIONS=1 flx_ls .. .*\.flx
[FLX_REPORT_COLLECTIONS] Collection report enabled
Actually collect
actually collected 623236 objects, still allocated 28264 bytes
Actually collect
actually collected 622187 objects, still allocated 45016 bytes
Actually collect
actually collected 623940 objects, still allocated 21832 bytes
Actually collect
actually collected 621171 objects, still allocated 61272 bytes
Actually collect
actually collected 619495 objects, still allocated 88088 bytes
Actually collect
actually collected 620826 objects, still allocated 68632 bytes
Actually collect
actually collected 623072 objects, still allocated 39720 bytes
Actually collect
actually collected 620232 objects, still allocated 76296 bytes
Actually collect
actually collected 619622 objects, still allocated 86056 bytes
Actually collect
actually collected 621365 objects, still allocated 58696 bytes
Actually collect
actually collected 619512 objects, still allocated 88200 bytes
Actually collect
actually collected 620547 objects, still allocated 72296 bytes
Actually collect
actually collected 620410 objects, still allocated 73448 bytes
Actually collect
actually collected 622320 objects, still allocated 45288 bytes
Actually collect
actually collected 621858 objects, still allocated 50960 bytes
Actually collect
actually collected 624227 objects, still allocated 20136 bytes
Actually collect
actually collected 623839 objects, still allocated 24000 bytes
Actually collect
actually collected 622069 objects, still allocated 46896 bytes
Segmentation fault

Running under gdb gives a different result entirely:

(gdb) run  .. .*\.flx
Starting program: /usr/local/bin/flx_ls .. .*\.flx
Reading symbols for shared libraries ++. done
[FLX_REPORT_COLLECTIONS] Collection report enabled
Actually collect
actually collected 623236 objects, still allocated 28264 bytes
Actually collect
actually collected 622187 objects, still allocated 45016 bytes
Actually collect
actually collected 623940 objects, still allocated 21832 bytes
Actually collect
actually collected 621171 objects, still allocated 61272 bytes
Actually collect
actually collected 619495 objects, still allocated 88088 bytes
Actually collect
actually collected 620826 objects, still allocated 68632 bytes
Actually collect
actually collected 623072 objects, still allocated 39720 bytes
Actually collect
actually collected 620232 objects, still allocated 76296 bytes
Actually collect
actually collected 619622 objects, still allocated 86056 bytes
Actually collect
actually collected 621365 objects, still allocated 58696 bytes
Actually collect
actually collected 619512 objects, still allocated 88200 bytes
Actually collect
actually collected 620547 objects, still allocated 72296 bytes
Actually collect
actually collected 620410 objects, still allocated 73448 bytes
Actually collect
actually collected 622320 objects, still allocated 45288 bytes
Actually collect
actually collected 621858 objects, still allocated 50960 bytes
Actually collect
actually collected 624127 objects, still allocated 21736 bytes
Actually collect
actually collected 624092 objects, still allocated 19952 bytes
Actually collect
actually collected 622244 objects, still allocated 44096 bytes
Actually collect
actually collected 623298 objects, still allocated 32176 bytes
Actually collect
actually collected 620509 objects, still allocated 71856 bytes
Actually collect
actually collected 620977 objects, still allocated 64368 bytes
Actually collect
actually collected 620596 objects, still allocated 70464 bytes
Actually collect
actually collected 618991 objects, still allocated 96144 bytes
Actually collect
actually collected 618641 objects, still allocated 101744 bytes
Actually collect
actually collected 618428 objects, still allocated 105152 bytes
Actually collect
actually collected 618640 objects, still allocated 101760 bytes
Actually collect
actually collected 617749 objects, still allocated 116016 bytes
Actually collect
actually collected 618844 objects, still allocated 98496 bytes
Actually collect
actually collected 618760 objects, still allocated 99840 bytes
Actually collect
actually collected 617376 objects, still allocated 121984 bytes
Actually collect
actually collected 617319 objects, still allocated 122896 bytes
Actually collect
actually collected 616561 objects, still allocated 135024 bytes
Actually collect
actually collected 616496 objects, still allocated 136064 bytes
Actually collect
actually collected 616403 objects, still allocated 137552 bytes
Actually collect
actually collected 617596 objects, still allocated 118464 bytes
Actually collect
actually collected 617025 objects, still allocated 127600 bytes
Actually collect
actually collected 615579 objects, still allocated 150736 bytes
Actually collect
actually collected 616925 objects, still allocated 129200 bytes
Actually collect
actually collected 615225 objects, still allocated 156400 bytes
Actually collect
actually collected 617746 objects, still allocated 116064 bytes
Actually collect
actually collected 614887 objects, still allocated 161808 bytes
Actually collect
actually collected 616838 objects, still allocated 130592 bytes
Actually collect
actually collected 616800 objects, still allocated 131200 bytes
Actually collect
actually collected 614407 objects, still allocated 169488 bytes
Actually collect
actually collected 617068 objects, still allocated 126912 bytes
Actually collect
actually collected 614103 objects, still allocated 174352 bytes
Actually collect
actually collected 614998 objects, still allocated 160032 bytes
Actually collect
actually collected 613811 objects, still allocated 179024 bytes
Actually collect
actually collected 616237 objects, still allocated 140208 bytes
Actually collect
actually collected 613527 objects, still allocated 183568 bytes
Actually collect
actually collected 621911 objects, still allocated 49512 bytes
Actually collect
actually collected 621937 objects, still allocated 50280 bytes
Actually collect
actually collected 619921 objects, still allocated 81272 bytes
Actually collect
actually collected 618745 objects, still allocated 100088 bytes
Actually collect
actually collected 617673 objects, still allocated 117240 bytes
Actually collect
actually collected 616600 objects, still allocated 134408 bytes
Actually collect
actually collected 616264 objects, still allocated 139784 bytes
Actually collect
actually collected 616333 objects, still allocated 138680 bytes
Actually collect
actually collected 617184 objects, still allocated 125064 bytes
Actually collect
actually collected 616275 objects, still allocated 139608 bytes
Actually collect
actually collected 615142 objects, still allocated 157736 bytes
Actually collect
actually collected 619510 objects, still allocated 87872 bytes
Actually collect
actually collected 618585 objects, still allocated 102640 bytes
Actually collect
actually collected 618168 objects, still allocated 109312 bytes
Actually collect
actually collected 617461 objects, still allocated 120624 bytes
Actually collect
actually collected 617971 objects, still allocated 112464 bytes
Actually collect
actually collected 617440 objects, still allocated 120960 bytes
Actually collect
actually collected 617448 objects, still allocated 120832 bytes
Actually collect
actually collected 617555 objects, still allocated 119120 bytes
Actually collect
actually collected 617440 objects, still allocated 120960 bytes
Actually collect
actually collected 615613 objects, still allocated 150192 bytes
Actually collect
actually collected 615887 objects, still allocated 145808 bytes
Actually collect
actually collected 624825 objects, still allocated 16168 bytes
Actually collect
actually collected 626492 objects, still allocated 15992 bytes

Program exited normally.
(gdb) 

The program didn't crash but it didn't list any *.flx files either ;(

The code here is:

  fun regfilesin(dname:string, re:RE2): list[string] = {
    fun rfi(dname2: string) =>   
      if dname2 == "." or dname2 == ".." then Empty[string] else
      match FileSystem::filesin(Filename::join (dname,dname2)) with
      | None  => Empty[string]
      | Some ?files =>
        List::fold_left 
          (fun (acc:list[string]) (f:string) => if f == "." or f == ".." then 
Empty[string] else
            let ?d = Filename::join (dname2,f) in
            let ?t = FileSystem::filetype (Filename::join (dname,d)) in
            match t with
              | REGULAR => 
                //let ?xx = dbg ("found file " + d) in
                if /* xx == 0 and */ Re2::Match(re, Re2::StringPiece d, 0, 
Re2::ANCHOR_BOTH, C_hack::null[Re2::StringPiece], 0) 
                then acc + d 
                else acc
                endif
              | DIRECTORY => acc + rfi (d)
              | _ => acc
            endmatch
            endif
          )
          Empty[string]
          files
      endmatch
      endif
    ;
    return rfi ("");
  }
 
The bit that makes the garbage are these:

acc + d
acc + rfi (d)

these add element to end of list, and concatenate two lists, respectively.
Actually, d+acc would garbage free (just adding head to list).
Indeed the whole algorithm could be made tail rec.. but that's not
the point! It serves well as a GC test as is :)

There's no Judy here .. definitely a GC or list handling bug!
At which point I'm entirely at a loss what to do (I've checked both
GC and list handling a gazillion times ..)

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
RSA® Conference 2012
Save $700 by Nov 18
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to