News for hackers. Stuff that matters.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by lbj on Sunday January 06, 2019 @11:18AM (#18839009)
Its a nifty tool, but I can't help feeling a little disappointed that we're still having to deal directly with issues such as memory allocation in 2019.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by EpicEng on Sunday January 06, 2019 @02:56PM (#18840218)
Well 'we' deal with it so that you don't have to. What do you suggest? Somewhere memory needs to be allocated, this stuff isn't magic.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by asveikau on Sunday January 06, 2019 @01:13PM (#18839640)
Somebody's got to deal with it so that you may have the luxury of not dealing with it.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by chrisseaton on Sunday January 06, 2019 @11:48AM (#18839144)
How do you think we should be dealing with memory allocation instead?
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by blattimwind on Sunday January 06, 2019 @01:14PM (#18839646)

    addr = getrandom(8);
    mem = mmap(addr, len, PROT_RWX, MAP_FIXED|MAP_ANON, -1, 0);
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by chrisseaton on Sunday January 06, 2019 @01:22PM (#18839683)
It's not realistic to use a per-allocation mapping like that in production - all your allocations will be scaled up to multiples of pages.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by jacquesm on Sunday January 06, 2019 @01:33PM (#18839741)
Whoosh!
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by saagarjha on Sunday January 06, 2019 @02:00PM (#18839908)
> PROT_RWX

Hmm…

Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by blattimwind on Sunday January 06, 2019 @02:09PM (#18839968)
The X is for fleXibility.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by rzzzt on Sunday January 06, 2019 @02:56PM (#18840212)
How else will you put the self-modifying code there?
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by benj111 on Sunday January 06, 2019 @12:09PM (#18839272)
You don't necessarily.

Don't forget that theres memory managed languages that compile to c. They still use malloc under the hood.

Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by lbj on Sunday January 06, 2019 @02:30PM (#18840059)
Thats a good point.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by aaaaaaaaaab on Sunday January 06, 2019 @02:10PM (#18839974)
Right? Just use JavaScript already! /s