▲ 265 ▼ How One Uncaught Rust Exception Took Out Cloudflare (hackaday.com) submitted 11 months ago by mesamunefire@piefed.social to c/technology@lemmy.world 57 comments fedilink hide all child comments
[–] SeductiveTortoise@piefed.social 46 points 11 months ago (5 children) But at least it wasn't a memory leak!!! 😭😭😭 permalink fedilink source parent hideshow 5 child comments replies: [–] Noja@sopuli.xyz 24 points 11 months ago (4 children) Memory leaks are logic errors, Rust can't really prevent you from leaking memory. permalink fedilink source parent hideshow 4 child comments replies: [–] calcopiritus@lemmy.world 19 points 11 months ago (2 children) It's really hard to do without Rc (or similar) or unsafe. permalink fedilink source parent hideshow 2 child comments replies: [–] Mechanize@feddit.it 29 points 11 months ago* (1 child) You can leak memory in perfectly safe Rust, because it is not a bug per se, an example is by using Box::leak Preventing memory leaks was never in the intentions of Rust. What it tries to safeguard you from are Memory Safety bugs like the infamous and common double free. permalink fedilink source parent hideshow 1 child comment replies: [–] 8uurg@lemmy.world 3 points 11 months ago And it still cleans up once the ownership model indicates it can be cleaned up. That does not ensure memory is never leaked, but it is equivalent to destructors running automatically when using unique ptr or shared ptr without cycles in C++, which avoids at least a portion of possible memory leaks. permalink fedilink source parent [–] socsa@piefed.social 8 points 11 months ago Some memory leaks are logic errors, and this is honestly the irony of modern dynamic languages. I have actually gotten into the argument in interviews before - it is arguably safer (and better) to work from maximal static memory allocations with memory safe data objects than it is to implement dynamic memory algorithms just because they are fun coding problems. permalink fedilink source parent
[–] Noja@sopuli.xyz 24 points 11 months ago (4 children) Memory leaks are logic errors, Rust can't really prevent you from leaking memory. permalink fedilink source parent hideshow 4 child comments replies: [–] calcopiritus@lemmy.world 19 points 11 months ago (2 children) It's really hard to do without Rc (or similar) or unsafe. permalink fedilink source parent hideshow 2 child comments replies: [–] Mechanize@feddit.it 29 points 11 months ago* (1 child) You can leak memory in perfectly safe Rust, because it is not a bug per se, an example is by using Box::leak Preventing memory leaks was never in the intentions of Rust. What it tries to safeguard you from are Memory Safety bugs like the infamous and common double free. permalink fedilink source parent hideshow 1 child comment replies: [–] 8uurg@lemmy.world 3 points 11 months ago And it still cleans up once the ownership model indicates it can be cleaned up. That does not ensure memory is never leaked, but it is equivalent to destructors running automatically when using unique ptr or shared ptr without cycles in C++, which avoids at least a portion of possible memory leaks. permalink fedilink source parent [–] socsa@piefed.social 8 points 11 months ago Some memory leaks are logic errors, and this is honestly the irony of modern dynamic languages. I have actually gotten into the argument in interviews before - it is arguably safer (and better) to work from maximal static memory allocations with memory safe data objects than it is to implement dynamic memory algorithms just because they are fun coding problems. permalink fedilink source parent
[–] calcopiritus@lemmy.world 19 points 11 months ago (2 children) It's really hard to do without Rc (or similar) or unsafe. permalink fedilink source parent hideshow 2 child comments replies: [–] Mechanize@feddit.it 29 points 11 months ago* (1 child) You can leak memory in perfectly safe Rust, because it is not a bug per se, an example is by using Box::leak Preventing memory leaks was never in the intentions of Rust. What it tries to safeguard you from are Memory Safety bugs like the infamous and common double free. permalink fedilink source parent hideshow 1 child comment replies: [–] 8uurg@lemmy.world 3 points 11 months ago And it still cleans up once the ownership model indicates it can be cleaned up. That does not ensure memory is never leaked, but it is equivalent to destructors running automatically when using unique ptr or shared ptr without cycles in C++, which avoids at least a portion of possible memory leaks. permalink fedilink source parent
[–] Mechanize@feddit.it 29 points 11 months ago* (1 child) You can leak memory in perfectly safe Rust, because it is not a bug per se, an example is by using Box::leak Preventing memory leaks was never in the intentions of Rust. What it tries to safeguard you from are Memory Safety bugs like the infamous and common double free. permalink fedilink source parent hideshow 1 child comment replies: [–] 8uurg@lemmy.world 3 points 11 months ago And it still cleans up once the ownership model indicates it can be cleaned up. That does not ensure memory is never leaked, but it is equivalent to destructors running automatically when using unique ptr or shared ptr without cycles in C++, which avoids at least a portion of possible memory leaks. permalink fedilink source parent
[–] 8uurg@lemmy.world 3 points 11 months ago And it still cleans up once the ownership model indicates it can be cleaned up. That does not ensure memory is never leaked, but it is equivalent to destructors running automatically when using unique ptr or shared ptr without cycles in C++, which avoids at least a portion of possible memory leaks. permalink fedilink source parent
[–] socsa@piefed.social 8 points 11 months ago Some memory leaks are logic errors, and this is honestly the irony of modern dynamic languages. I have actually gotten into the argument in interviews before - it is arguably safer (and better) to work from maximal static memory allocations with memory safe data objects than it is to implement dynamic memory algorithms just because they are fun coding problems. permalink fedilink source parent