Re: [Lcms-user] lcms 2.0 beta 2 fails to build on Mac OS X 10.6

2010-03-05 Thread Marti.Maria


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:0x0038  0x  0x0001  0x
0x100100160:0x  0x  0x  0x
0x100100170:0x  0x  0x  0x


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


Re: [Lcms-user] lcms 2.0 beta 2 fails to build on Mac OS X 10.6

2010-03-04 Thread Peter Speck
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:0x0038  0x  0x0001  0x
0x100100160:0x  0x  0x  0x
0x100100170:0x  0x  0x  0x


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


Re: [Lcms-user] lcms 2.0 beta 2 fails to build on Mac OS X 10.6

2010-02-26 Thread marti . maria
Quoting Peter Speck :

>
> --- building in 64 bit mode:
>
> ./configure --prefix=/my/path
> make
> make check
>
> This fails with:
> Arrr!!: Trying to free memory allocated by a different thread!
>
> Output:
> http://pastebin.com/nDeuAaxa
>

Good finding. Thanks so much for reporting.
As you can see the new testbed is much picky that the old one, hope
that would help to catch more bugs earlier.

Regards
Marti.

--
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