Skip to main content

Questions tagged [memory-safety]

For questions about memory safety features in programming languages, to prevent misuse of memory and related errors.

8 votes
2 answers
755 views

Overview Ensuring memory safety is a core facet of modern programming language design. Memory safety can be guaranteed in many different ways. For the purposes of this question, I am defining memory ...
Wesley Jones's user avatar
16 votes
3 answers
6k views

One of the most known ones is Rust, but what others implement this?
user avatar
7 votes
0 answers
344 views

Context For memory safe languages to be fast, array bounds should be checked during compilation. Some language like Java, Rust, Swift, and others eliminate array bounds checks when possible, but the ...
Thomas Mueller's user avatar
8 votes
5 answers
4k views

RAII, the acronym for "resource acquisition is initialization", is a crucial paradigm of C++ that is meant to prevent the following things: Forgetting to free a dynamic storage Forgetting ...
Dannyu NDos's user avatar
  • 1,485
8 votes
4 answers
5k views

I am new to language development. I am aware of Rust's ownership model that builds programs in a way that does not need garbage collection. So if I am to build a new programming language using safe ...
M4X_'s user avatar
  • 191
23 votes
10 answers
6k views

In C, accessing any indeterminate/uninitialized memory is undefined behavior, period. Even in the case that the type in question is guaranteed to have no trap representations, such as ...
CPlus's user avatar
  • 10.5k
3 votes
1 answer
333 views

I think there are languages where most of the standard library is written in themselves, however with most things marked as native or ...
Hydroper's user avatar
  • 1,047
0 votes
1 answer
948 views

I really like what Rust brings to the table, but I find it very difficult to work with if I am not really working on apps that require absolute speed and the lower-levelness e.g. specifying int sizes, ...
Ong Teck Wu's user avatar
11 votes
4 answers
976 views

In Rust, creating a raw pointer is allowed in safe code (i.e. outside of unsafe blocks), but then dereferencing it is unsafe: ...
mousetail's user avatar
  • 9,627
6 votes
5 answers
886 views

How can weak references (weakrefs) be implemented, and how do the different approaches compare? The most important considerations for implementing weakrefs are: Safety ─ a weakref shouldn't allow ...
kaya3's user avatar
  • 22.4k
15 votes
2 answers
761 views

Rust famously has the concept of ownership vs. borrowing as part of its type system. This allows some level of automatic memory management ─ that is, heap allocations are freed when their owner goes ...
kaya3's user avatar
  • 22.4k
14 votes
4 answers
2k views

Rust has a number of memory safety features. Is it possible to extend or enhance C or C++ to also provide similar memory safety features instead of using workarounds such as the Valgrind tool suite?
James Risner's user avatar