[rust-dev] How to allocate record on memory?

Alexander Stavonin a.stavonin at gmail.com
Tue Apr 17 19:24:18 PDT 2012


I need unmanaged, C-compatibe structure on heap which will not be
autodeleted in any cases.

I don't *really* understand what you are trying to do, but I think you
> have two choices:
>
> (1) A call to libc::malloc, like you showed in your later mail.
>
> (2) Allocate the type as a @T and then use ptr::addr_of(*x) to get an
> unsafe ptr from that.  Then you are responsible for keeping a live
> reference to the @T so that we don't collect it.
>
>
> Niko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120418/a6cc0931/attachment.html>


More information about the Rust-dev mailing list