[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Damien Doligez <damien.doligez@i...> |
| Subject: | Re: [Caml-list] no_scan_tag and int array |
Hello, On 2010-03-06, at 10:26, ygrek wrote: > So, as expected, setting No_scan_tag on the array of integers prevents GC from uselessly > scanning the huge chunk of memory. Looks like polymorphic array functions still work fine and > GC correctly reclaims array memory when it is not referenced anymore. > Apparantly this trick is not allowed for float array as they have a special tag set. The trick is not needed for float arrays, the GC already doesn't scan them. > The question is - how safe is this? It's safe, and will be in the forseeable future. BUT: you should use Abstract_tag and not No_scan_tag. Abstract_tag means "don't make assumptions about the contents of this block", while No_scan_tag is just the min of all the tags that the GC is not supposed to scan. Right now they are equal, but a future version of OCaml might have No_scan_tag = Double_array_tag, which would break your code. > And even more, could the compiler itself set this tag? This is a bit tricky because you have to make sure that the static type of the array is "int array". Unlike floats, a run-time test at allocation will not work. You should enter this as a feature wish in the BTS. -- Damien