Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MT search programming questions

Author: Daniel Shawul

Date: 01:16:48 11/18/04

Go up one level in this thread


On November 18, 2004 at 03:43:15, Daniel Clausen wrote:

>On November 17, 2004 at 13:39:20, Robert Hyatt wrote:
>
>>On November 17, 2004 at 07:50:29, Daniel Shawul wrote:
>>
>>>I have some programming difficulties on multi threaded search.
>>>
>>>One problem is that allocating memory in search is a problem
>>>
>>>search(alpha,beta,...)
>>>{
>>>   SPLIT* p_split;
>>>   p_split = new SPLIT;
>>>
>>>   if(search in parallel)
>>>      searchInparallel(...)
>>>   else
>>>      search()
>>>
>>>   delete p_split;   //here it crashes
>>>}
>>>
>>>The error message says "you can only delete memory from *local* heap".
>>>Do threads have their own heap memory?
>>
>>Nope.  Each thread does have it's own stack memory, although any thread can
>>see any other thread's stack if it tries hard enough since all memory is
>>shared among threads...
>
>I agree with that, but I'm wondering what compiler Daniel is using? I mean, if
>the error message from the compiler really is was he said, it must be seriously
>broken. :)

   i found this message not from a compiler warning rather as comment with in a
library files while debugging the "delete" fucntion(which is causing the
problem). At some point with in the fucntion there is a pointer assertion
failure,and the comment on the code says the pointer is from a
different heap.
daniel


>
>
>>>Another question is do i need to lock/unlock common data for threads
>>>which is a read only type?
>>
>>Nope.  Only if it is modified.
>
>But if the common data can't be read atomically, you either need to make sure
>noone's writing the data while someone's reading it (typically done with a
>semaphore, which is a rather slow way for a chess engine) or you have to verify
>the integrity of the data after the read. That or I'm missing something here. :)
>
>Sargon



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.