News for hackers. Stuff that matters.
Re:On programming without malloc by IgorPartola on Wednesday December 04, 2013 @05:44PM (#6851005)
You probably want to align the memory you return as well instead of having size be an arbitrary value.
Re:On programming without malloc by a-priori on Wednesday December 04, 2013 @07:01PM (#6851560)
You're right, it should word-align the addresses, but I didn't want to complicate things. This was just supposed to be a 'minimum viable allocator' to shove into a kernel temporarily then move onto other more interesting things.
Re:On programming without malloc by gizmo686 on Wednesday December 04, 2013 @06:43PM (#6851433)
What advantage does aligning it have, given that you are already satisfied with using an allocater that cannot free memory.
Re:On programming without malloc by ArbitraryLimits on Wednesday December 04, 2013 @07:19PM (#6851654)
None on Intel chips, but on virtual any other chip you'd get SIGBUS by referencing e.g. an N-bit datum not alinged on N/8-byte boundaries.