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.

Malloc

From Esolang
Jump to navigation Jump to search

Malloc is a joke esolang created by User:None1. All it can do is allocating memory.

Syntax

Malloc has only one command - malloc. The syntax of the malloc command is:

malloc x

That will allocate x bytes of memory. Malloc CAN'T free the memory it allocated.

Example Programs

Allocate one byte of memory:

malloc 1

Allocate 1KiB of memory:

malloc 1024

Alternative:

malloc 512
malloc 512

Allocate the most memory possible in 1 line (2GiB?):

malloc 2147483647

(Be careful, running this will leak a lot of memory)

Damage the computer:

malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647
malloc 2147483647

Allocates 128 GiB of memory, most computers don't have that much memory. How to fix it? Restart your computer!

Interpreters

C

#include<stdlib.h>
#include<stdio.h>
int main(){
    int x;
    while(scanf("malloc %d\n", &x)!=EOF){
        malloc(x);
    }
    return 0;
}