Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Memory allocation anomaly.

Author: Dann Corbit

Date: 19:26:20 03/17/05

Go up one level in this thread


On March 17, 2005 at 21:40:38, Robert Hyatt wrote:

>On March 17, 2005 at 21:16:36, Dann Corbit wrote:
>
>>On March 17, 2005 at 17:07:15, Robert Hyatt wrote:
>>
>>>On March 17, 2005 at 14:47:24, Matthew Hull wrote:
>>>
>>>>I have two vanilla builds of GNUChess 5.07.  One is in CYGWIN, the other in
>>>>Linux.  Both are on x86 architecture.  But each allocates hash memory in
>>>>different volumes.
>>>>
>>>>Example command:
>>>>
>>>>./gnuchess -s 10000000
>>>>
>>>>On Cygwin, this allocates 393216K of hash memory.
>>>>
>>>>On Linux, it allocates 327680K
>>>>
>>>>What is the reason for this?
>>>
>>>Several possibilities.  But first, have you started both programs without the -s
>>>option to see how big they are, then restarted both with the -s to see the
>>>difference?
>>
>>Some other likely differences:
>>
>>1.  structure packing (since the hash table seems to be an 'entries' count if
>>the struct is aligned differently it will not be at all surprising if the same
>>count of structs has different sizes on two machines.
>>
>>2.  memory page sizes are different (small differences will be explained this
>>way)
>
>On the PC the pagesize is 4K period.  Unless you use the huge page-size which
>most operating systems do not use (4mb for intel, I think AMD opteron supports a
>2M page size as well).
>
>I can't imagine anyone with a hash entry size that is not a multiple of 4/8,
>which would eliminate the packing issue on the X86 box...

E:\pgn\WINBOA~1\GNUCHE~1.07\src>type foo.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
int             main(void)
{
    HashSlot        hs;
    printf("sizeof HashSlot = %u\n", (unsigned) sizeof hs);
    return 0;
}

E:\pgn\WINBOA~1\GNUCHE~1.07\src>cl /Zp8 foo.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

foo.c
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:foo.exe
foo.obj

E:\pgn\WINBOA~1\GNUCHE~1.07\src>foo
sizeof HashSlot = 24

E:\pgn\WINBOA~1\GNUCHE~1.07\src>cl /Zp4 foo.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

foo.c
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:foo.exe
foo.obj

E:\pgn\WINBOA~1\GNUCHE~1.07\src>foo
sizeof HashSlot = 20





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.