On Thu, Jun 6, 2013 at 12:29 PM, Abhijeet Gaiha <[email protected]> wrote: > Hi, > > Servo uses several c libraries through Rust wrappers. In such a situation, > I'm curious as to where is the memory for malloc calls inside these > libraries allocated from? This doesn't seem to fit into the standard > locations viz. Task Heap, Exchange Heap and Local stack. In C programs there > is a global heap, but nothing in the rust docs I've looked at so far > suggests such a thing exists right now. Which leads me to this question. > > Thanks, > Abhijeet
The malloc/free functions are wrappers on top of sbrk and/or mmap (or similar calls on Windows) to obtain memory from the OS. All memory allocators get the memory from the same place and the process has one address space, so there isn't really a difference. In fact right now, Rust obtains all heap memory from the system's C library malloc/free (likely soon to be jemalloc instead). The local heap and exchange heap don't really exist, they're terms the documentation used as an attempt to explain how things work, but it was never really accurate. Unique pointers/vectors containing managed boxes would be on the "local heap" if we did have one. The only distinction we should make is that Owned types (soon to be renamed Send) are sendable and other types are task-local. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
