8769409612
I need these in the context of doing various malloc/free operations for libuv structs that need to live in the heap, because of API workflow (there's no stack to put them in). This has cropped up several times when impl'ing the high-level API for things like timers, but I've decided to take the plunge and use this approach for the net::tcp module. Technically, this can be avoided by spawning a new task that contains the needed memory structures on its stack and then having it block for the duration of the time we need that memory to be valid (this is what I did in std::timer). Exposing this API provides a much lower overhead way to address the issue, albeit with safety concerns. The main mitigation policy should be to use malloc/free with libuv handles only when the handles, are then associated with a resource or class-with-dtor. So we have a finite lifetime for the object and can gaurantee a free(), barring a runtime crash (in which case you have bigger problems!) |
||
---|---|---|
doc | ||
man | ||
mk | ||
src | ||
.gitignore | ||
.gitmodules | ||
AUTHORS.txt | ||
configure | ||
INSTALL.txt | ||
LICENSE.txt | ||
Makefile.in | ||
README.txt | ||
RELEASES.txt |
This is a compiler and suite of associated libraries and documentation for the Rust programming language. See LICENSE.txt for terms of copyright and redistribution. See http://www.rust-lang.org for more information.