You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function comes from POSIX, and it's properly part of <unistd.h>, which we don't have, not <stdlib.h>. Accordingly, it was suspect for us ever to have included it, especially since the standard has an equivalent in <stdlib.h>, _Exit. Accordingly, all uses of _exit in the SDK have been rewritten to use _Exit, and this should be the mechanism defined by new targets going forward.
This is a version of malloc that supports a power of two alignment specification. This can be useful when sizes of allocated objects are naturally powers of two, since it allows stashing data in the low bits of pointers to the objects. Plus it's in the C standard ;)
quick_exit allows exiting from the program without running C++ destructors, but while still doing other process-related cleanup. (Once we have a stdio, this will typically mean flushing and closing open files.) It also adds an at_quick_exit to allow registering callbacks to occur on quick exit (atexit handlers do not).
This makes our implementation of malloc a standard Knuth boundary tag allocator that allocates in first fit FIFO order. This removes all O(n) operations that except the single first-fit freelist scan; accordingly, free is now constant time instead of O(n). It also removes all heap space overhead except the two byte header per malloc. The cost is a modestly increased code size and that heap objects are now two-byte aligned.
Bug fixes
#289 -- NES GTROM -- Declare write_ppu to return void -- @cwedgwood
e61baad - calloc now correctly detects integer overflow in its multiplication and returns NULL, rather than producing undefined behavior.