코딩Coding/Rust❤️메모리Memory관리_기초상식

Rust way of dealing with memory allocation

내인생PLUS 2023. 9. 6. 19:19
728x90

Rust way of dealing with memory allocation

So I'm following [this](
https://cstack.github.io/db_tutorial/

How Does a Database Work?

Writing a sqlite clone from scratch in C

cstack.github.io


) tutorial as a kind of side project. But instead of building it in C, like the author did, I'm trying to build it in rust.

In [part 3](https://cstack.github.io/db_tutorial/parts/part3.html), they allocate 4kb chunks to store the data (to match the pagesize), and they just copy the data into that block of memory, like you do in C.

But I was wondering how you would accomplish what the author is doing here (store the data in pages), while sticking to the Rust way of doing things. Sure you _could_ do exactly what they're doing, but is that what you're _supposed_ to do?


https://www.reddit.com/r/rust/comments/ukz786/rust_way_of_dealing_with_memory_allocation/?utm_source=share&utm_medium=ios_app&utm_name=ioscss&utm_content=2&utm_term=1

From the rust community on Reddit: Rust way of dealing with memory allocation

Explore this post and more from the rust community

www.reddit.com















반응형