Conversation

what would a truly *absurd* malloc() and free() look like?

3
0
0

@cas let me just say one word: fopen

1
0
0

@cas
1. premise
- uuid v4 will never generate the same uuid
- since theyre unique now every pointer is a uuid
- its statistically impossible that a uuid can collide, therefore it can never happen in the lifetime of the universe
- this means we can make a new uuid for every malloc
- ultra fast sleek design, innovative solution

fn malloc(size: usize) -> Uuid {
uuid::new_v4()
}

fn free(mut ptr: Uuid) {
ptr = uuid::from(0);
}

1
0
0

@angelthorns hmm but that doesn't return a valid (in the progeam context which to be fair could be bare metal) pointer...

0
0
0

@cas Here you go! {c7f01a6d-5219-4f4d-b3c9-ae11a9610822}

0
0
0

@cas a more advanced, *cough* I mean "lean" implementation could just use system("mktemp")

0
0
0