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)

Interpreters

C

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