Difference between "stored in binary executable" and otherwise?

⚓ rust    📅 2025-05-21    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 39 days ago. The information described in this article may have changed.

I don't know more about memory than Heap and Stack, the Chapter 4 explains that fixed size data is in the Stack, and then suddenly says:

In the case of a string literal, we know the contents at compile time, so the text is hard-coded directly into the final executable.

Is this valid for all non-mutable Stack data ? Is the final executable itself on the Stack ?

What would be a good way to harmonise this memory (assuming it's different), with the prior knowledge of Stack and Heap? Is this string literal then not in the Stack, or maybe I misunderstood ?

Relevant (not too hard) links are welcome if this is too long to be explained here.

7 posts - 4 participants

Read full topic

🏷️ rust_feed