Conversation

allocating a double[1000][1000] on the stack segfaults .. sad ..

2
0
2
@fiore fiore stop comitting computer crimes what the fuck
2
0
0
@fiore you should use linked lists in any case O(1) is a meme
1
0
1
@fiore i like trees i think you should use trees
0
0
2

@chjara idk i think its just that the stack size is way smaller or smth ? idk

0
0
2

@coolbean it feels dirty ok . when i do Box::new() i know i wont have to clean up anything and it will be valid and cool . but malloc(3) .. that scares me …

2
0
2
@fiore if you forget to free it literally just ^C to make the kernel clean it up for you. its ok to memory leak for a simulation if you'll be done before you run out of ram
2
0
1
@fiore god thats the dirtiest thing ive ever said i feel nasty about that one

its true though it only becomes a problem if it crashes before ur done
0
0
3

@coolbean yea but what if i double free what if i use after free what if i forget to check for nullptr what if what if aaaaa

1
0
0
@fiore @coolbean even for your 2d array allocating everything is a matter of allocating one thing and then using a for loop to allocate and free the rest of the things. check for errors of course i forgor to do that here
2
0
2
@fiore i dont free there either its not a long-running process, cleanup doesnt matter
0
0
1
@fiore like a double is like what 8 bytes? ive got 32gb of ram thats 32 billion bytes thats enough room for 4 billion doubles
1
0
1
@fiore not accounting for os overhead because really why not use a unikernel

funnily enough thats actually a real thing in ocaml land theres a library for ez unikernels so you can totally just do that ocaml is weirdly useful for embedded stuff as a result which is quite unique and enjoyable for a functional language
0
0
1