[
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] Finalising bigarrays |
On Mar 25, 2004, at 02:01, Shivkumar Chandrasekaran wrote: > I tried calling Gc.finalise on a bigarray and it did not raise an > exception. Does that mean finalisation of bigarrays will work? A bigarray is composed of two things: a heap-allocated descriptor block that tells the number of dimensions, the layout, etc, and contains a pointer to the data. The data is in an out-of-heap block. When you call Gc.finalise, you are finalising the descriptor block. That would not matter if there was a one-to-one mapping between descriptor blocks and data blocks, but sometimes the data block is shared between bigarrays (when you call slice_left, slice_right, sub_left, sub_right, or the reshape functions). Your finalisation function is called when the bigarray itself is not used any more by your program, but you should beware that its data may be used by other bigarrays. Hence your finalisation function must not overwrite the data, unless you are really sure that it is not shared. -- Damien ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners