X-Git-Url: http://git.annexia.org/?p=ocaml-ancient.git;a=blobdiff_plain;f=ancient.mli;h=ed3e680ae2f65723700e4581222d78151b23fb9f;hp=6bf689fcb9b4f5612c3d06c40afff343ce7195f9;hb=refs%2Fheads%2Fmaster;hpb=690b40de4026658d385caf2cdbfa13837a1e679e diff --git a/ancient.mli b/ancient.mli index 6bf689f..ed3e680 100644 --- a/ancient.mli +++ b/ancient.mli @@ -1,6 +1,4 @@ -(** Mark objects as 'ancient' so they are taken out of the OCaml heap. - * $Id: ancient.mli,v 1.5 2006-10-06 15:03:47 rich Exp $ - *) +(** Mark objects as 'ancient' so they are taken out of the OCaml heap. *) type 'a ancient @@ -30,6 +28,16 @@ val delete : 'a ancient -> unit * Forgetting to delete an ancient object results in a memory leak. *) +val is_ancient : 'a -> bool + (** [is_ancient ptr] returns true if [ptr] is an object on the ancient + * heap. + *) + +val address_of : 'a -> nativeint + (** [address_of obj] returns the address of [obj], or [0n] if [obj] + * is not a block. + *) + (** {6 Shared memory mappings} *) type md @@ -72,10 +80,8 @@ val share : md -> int -> 'a -> 'a ancient * other OCaml processes which can access the underlying * file. See {!Ancient.attach}, {!Ancient.detach}. * - * More than one object can be stored in a file. They are - * indexed using integers in the range [0..1023] (the limit - * is hard-coded in [mmalloc/mmprivate.h]). The [key] parameter - * controls which object is written/overwritten by [share]. + * More than one object can be stored in a file. The [key] + * parameter controls which object is written/overwritten by [share]. * If you do not wish to use this feature, just pass [0] * as the key. * @@ -96,9 +102,7 @@ val get : md -> int -> 'a ancient (** [get md key] returns the object indexed by [key] in the * attached file. * - * The key is in the range [0..1023] (the limit is hard-coded in - * [mmalloc/mmprivate.h]). If you do not wish to use this feature, - * just pass [0] as the key when sharing / getting. + * For details of the [key] parameter see {!Ancient.share}. * * You need to annotate the returned object with the correct * type. As with the Marshal module, there is no type checking, @@ -108,3 +112,19 @@ val get : md -> int -> 'a ancient * * @raises [Not_found] if no object is associated with the key. *) + +(** {6 Additional information} *) + +type info = { + i_size : int; (** Allocated size, bytes. *) +} + (** Extra information fields. See {!Ancient.mark_info} and + * {!Ancient.share_info}. + *) + +val mark_info : 'a -> 'a ancient * info + (** Same as {!Ancient.mark}, but also returns some extra information. *) + +val share_info : md -> int -> 'a -> 'a ancient * info + (** Same as {!Ancient.share}, but also returns some extra information. *) +