Hi Peter

Thanks. It is now fixed on git. Tomorrow I will release beta2 tarballs
with all fixes.

Best regards
Marti


Peter Speck wrote:
Hi Marti,

The subject was wrong in the previous emails. It should of course have been "beta 
1".

I've tried building the new beta 2, and 'make check' fails on 64-bit OSX: The first call 
to DebugFree fails with "allocated by a different thread".

The reason is that the DebugMalloc/DebugFree functions assume that the MemoryBlock struct 
doesn't have any padding between members. But on x86-64, the struct is padded with 4 
bytes after "KeepSize" as all pointers must be 8-byte aligned (true for linux 
too).

typedef struct {
    cmsUInt32Number KeepSize;
    cmsContext WhoAllocated;
    cmsUInt8Number mem[1];
} MemoryBlock;


So the calculation of the block header offset fails when using this define:
#define SIZE_OF_MEM_HEADER (sizeof(cmsUInt32Number) + sizeof(cmsContext))

Breaking in DebugFree, with (void*)Ptr argument = 0x100100160
(gdb) x/32x (0x100100160 - 16)
0x100100150:    0x00000038      0x00000000      0x00000001      0x00000000
0x100100160:    0x00000000      0x00000000      0x00000000      0x00000000
0x100100170:    0x00000000      0x00000000      0x00000000      0x00000000


Changing KeepSize to cmsUInt64Number (and updating the #define) makes the 
testbed run successfully - and the returned memory will always be 8 and 16-byte 
aligned.  Only adding 12 bytes may break for 32-bit platforms that require 
8-byte alignment for e.g. doubles, so always using 64 bit for the size might be 
the easiest solution even for 32-bit platforms.

----
   - Peter Speck



------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user
------------------------------------------------------------------------


Se certifico que el correo entrante no contiene virus.
Comprobada por AVG - www.avg.es Version: 9.0.733 / Base de datos de virus: 271.1.1/2722 - Fecha de la version: 03/04/10 20:34:00


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to