Skip to main content

Questions tagged [memory-management]

For questions related to managing memory in programming languages, whether manually or automatically.

5 votes
1 answer
262 views

When implementing matrices/two-dimensional arrays, some languages choose to store them row-major, whereas others choose column-major (for example, fortran and C). This makes equivalent sequential ...
warren's user avatar
  • 169
4 votes
0 answers
203 views

Local allocators can be beneficial in situations where tracking memory usage or releasing all allocated memory without running destructors at the end of an activity is possible. From that perspective, ...
feldentm's user avatar
  • 2,498
13 votes
4 answers
2k views

In many languages, the integer type of array sizes are unsigned. This as the value type is not wrong, as array sizes are always non-negative. But the implications that their arithmetic also returns ...
user23013's user avatar
  • 3,314
10 votes
2 answers
697 views

I am working on a new backend for a programming language using LLVM IR. This language makes a distinction between basic values and pointers to nodes on the heap, and uses a copying collector for ...
user65560's user avatar
  • 200
14 votes
3 answers
4k views

Modern operating systems usually use some of the main memory for caching files, as loading those files from the cache will be faster than loading them from disk; but this memory can be reclaimed by ...
kaya3's user avatar
  • 22.4k
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
5 votes
1 answer
292 views

What are some alternatives to tracing GC for dynamically-typed languages? I've been interested in dynamically typed languages with predictable behavior since learning about lua in the NetBSD kernel. ...
Greg Nisbet's user avatar
4 votes
2 answers
720 views

In the normal implementations of C++, while not guaranteed by the standard, there is a vtable pointer as the header of every inherited class that needs a vtable pointer. There will be multiple vtable ...
user23013's user avatar
  • 3,314
3 votes
0 answers
373 views

Say I'm designing a virtual machine for a bytecode compiler/interpreter, using C as the implementation language. Some kind of “tagged” representation of values is simplest for this language, where ...
texdr.aft's user avatar
  • 323
3 votes
6 answers
644 views

In a scope that defines two variables a and b, the code firstly does things only on a. Then <...
user23013's user avatar
  • 3,314
6 votes
4 answers
1k views

Mark-and-Sweep garbage collection need to work over the graph of all objects in the process, and would stall threads to make the operation safe with regard to threads. I can think of no way to work ...
DannyNiu's user avatar
  • 467
22 votes
2 answers
4k views

I want to remove explicit addressing from my type system. In low level languages like C or Rust, you always have a choice whether to store some data by value or by reference. There are some advantages ...
mousetail's user avatar
  • 9,627
16 votes
3 answers
825 views

This is the first breaking change that C made, which was making realloc(ptr, 0) have UB instead of being roughly equivalent to ...
user1345541's user avatar
2 votes
1 answer
336 views

Some examples: To support checking whether an object is of a subclass of a specific class in constant time, in a language using single inheritance, the compiler could arrange the vtables of classes ...
user23013's user avatar
  • 3,314
17 votes
6 answers
4k views

Do you think it is possible to have a language that uses garbage collection (GC) by default, but allows you take more control with manual memory management like C++ or Rust, in areas of the software ...
Rob N's user avatar
  • 1,185

15 30 50 per page