Closed Rufis01 closed 1 year ago
I have been rewriting some parts of the SDK in C (fixing several bugs along the way) and the standard library is what I am working on right now. I'm probably going to implement realloc()
as part of my rewrite, however you should not rely on it for anything other than shrinking allocated buffers as memory copying is particularly slow on the PS1. The default allocator is very simple, it's only meant to be used as a "master allocator" of sorts for a set of smaller, manually managed memory pools tailored to specific use cases. You should not expect much from it in terms of performance or efficiency.
Also keep in mind that malloc()
and free()
are declared as weak functions, so you can override them and the rest of the SDK will use your custom allocator.
@Rufis01: I have finally replaced the old allocator and added realloc()
to my psxmdec branch. I'm going to open a PR once a few other things (i.e. string library improvements, a slightly faster Huffman decoder implementation and a video playback example) are in place, but you can already use my fork in the meantime.
realloc()
has been available in the master branch since v0.20 so I'm closing this issue.
As per title, realloc is not implemented. It'd be nice, since malloc->memcpy->free can be way less efficient.