* [Caml-list] Weak module
@ 2006-07-24 2:35 Jonathan Roewen
2006-07-24 4:33 ` Jacques Garrigue
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Roewen @ 2006-07-24 2:35 UTC (permalink / raw)
To: caml-list
For the weak module, if some value is pointing to another value which
is in a weak array, can that value be erased by the Gc still?
e.g. type my_t = (int32, int32_elt, c_layout) Array1.t (* bigarray *)
and I had a weak array of my_t, and was holding on to an int32 inside
the bigarray...
Jonathan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Weak module
2006-07-24 2:35 [Caml-list] Weak module Jonathan Roewen
@ 2006-07-24 4:33 ` Jacques Garrigue
0 siblings, 0 replies; 2+ messages in thread
From: Jacques Garrigue @ 2006-07-24 4:33 UTC (permalink / raw)
To: jonathan.roewen; +Cc: caml-list
From: "Jonathan Roewen" <jonathan.roewen@gmail.com>
> For the weak module, if some value is pointing to another value which
> is in a weak array, can that value be erased by the Gc still?
>
> e.g. type my_t = (int32, int32_elt, c_layout) Array1.t (* bigarray *)
>
> and I had a weak array of my_t, and was holding on to an int32 inside
> the bigarray...
You cannot hold on to anything inside a bigarray: this is just an
array of bytes where you read and write data. A new int32 block is
allocated every time you extract a value from the bigarray.
Note that the same thing is true for a "float array": it is not an
array of pointers to floats, but a flat array of doubles.
In both cases, a pointer to the value you wrote in the array may be
disposed of afterwards, if nobody else keeps it.
Jacques Garrigue
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-07-24 4:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-24 2:35 [Caml-list] Weak module Jonathan Roewen
2006-07-24 4:33 ` Jacques Garrigue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox