[kde-freebsd] ARM-related patches for qt4
Björn König
bkoenig at alpha-tierchen.de
Fri Jul 27 00:35:53 CEST 2007
Michael Nottebrock schrieb:
> [...] One more question, does
> this malloc.c cause a runtime or a buildtime error?
Short answer: The file causes a runtime error.
Long answer: Even simple applications don't work, e.g.
#include <qapplication.h>
int main(int argc, char *argv[]) {
QApplication app(argc, argv, false);
return (app.exec());
}
If you execute this program then you'll get the following error message:
***MEMORY-ERROR***: [8069]: GSlice: failed to allocate 248 bytes
(alignment: 256): Invalid argument
The reason for this is that glib uses the posix_memalign function which
has been redefined by malloc.c. In this example the function will be
called with the parameters alignment=256 and size=248.
POSIX states: "The value of alignment shall be a multiple of sizeof( void
*), that is also a power of two."
This is true for the alignment parameter, but the posix_memalign function
of malloc.c does something else:
if (size % sizeof (void *) != 0 || (size & (size - 1)) != 0)
It does these checks with the size parameter instead. That's why it
doesn't work at all.
Regards
Björn
More information about the kde-freebsd
mailing list