For example, if we forget about optimizing the return value and have the following code:
fn func() -> Box<String> { Box::new(String::new()) } fn main() { let boxed_string = func(); }
will the compiler create regions for memory management or use the usual heap allocation?
I know that this simple code can be optimized, but in more complex code it may not be so.
"" , , Rust . . :— , , ( C-style malloc), , , , typed-arena. , , . , , .
malloc
typed-arena
. Box::new - , , String::new .
Box::new
String::new
Source: https://habr.com/ru/post/1654481/More articles:IF внутри LINQ SELECT для включения столбцов - c#Error FIrebase 401 FCM in Android - androidНомер строки исключений в CSharpScript.EvaluateAsync - c#How to implement trinomial extension without nested loops. - cUIView frame and borders are incorrect - iosЗамена большого ReadOnlyDictionary - Сбор мусора - garbage-collectionReturns a Scala object to C ++ using JNI - javaHow to create CRUD with gRPC service without much repetition? - protocol-buffersRegex is a matching string that: and - regexAzure Service Fabric and scheduled tasks - scheduled-tasksAll Articles