We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Mixed allocators

From Esolang
Jump to navigation Jump to search
Mixed allocators
Designed by User:RaiseAfloppaFan3925
Appeared in 2026
Computational class Below combinational logic
Reference implementation Unimplemented
Influenced by Malloc, Double free

Mixed allocators is an esoteric programming language and a derivative of Double free made by User:RaiseAfloppaFan3925 in 2026 based on the undefined behavior of mixing the C (malloc and friends) and C++ (new and friends) memory allocators in C++.

Double free is used as a base for the syntax and semantics of Mixed allocators. If you haven't understood Double free, you likely won't be able to understand Mixed allocators.

Syntax

The syntax for new and new[] are the same as in C++.

intptr : new int
intarrptr : new int[10]

delete and delete[] are the same as well.

delete intarrptr
delete[] intptr

This means that new and delete are reserved words and cannot just be used as identifiers.

Examples

Normal program, as it should be.

?! x
?! y
?! z
x : malloc 10
free x
y : new int()
delete y
z : new char[10]
delete z

Invoke undefined behavior

?! x
x : malloc 90
delete[] x
?! my_array
?! my_double
my_array : new int[-1]
my_double : new double()
free my_double
delete my_array

Double free

Using malloc

?! ptr
ptr : malloc 15
free ptr
free ptr

Using new

?! ptr
ptr : new int()
delete ptr
delete ptr

Using new[]

?! ptr
ptr : new int[41]
delete[] ptr
delete[] ptr

See also