But I want to verify I have a proper understanding of a couple of questions before preceding.
My two immediate questions are:
1. Are "class" facts (not object facts) global across all threads or thread local (I'm planning on making the next iteration of the chess engine multi-threaded).
2. If I allocate memory using "memory::allocAtomicHeap", my understanding from the documentation is that the garbage collector will not scan that memory for cleanup. However, the pointer itself, will eventually be cleanup up after it goes out of scope. Is this true?
Thanks in advance,
Code: Select all
implement memtest open core class facts ptr:pointer := erroneous. itemSize:positive := 10. clauses new() :- % I don't want this checked by the garbage collector to check this memory (for performance), but want it cleaned up then the % object goes out of scope... ptr := memory::allocAtomicHeap(sizeOfDomain(integer64) * itemSize, memory::contextType_binary), init_data(), fast_data_access(). predicates init_data:(). clauses init_data() :- % simulating random access to set items I = std::downTo(9, 0), T1_ = uncheckedConvert(integerNative, ptr), T2_ = T1_ + sizeofDomain(integer64) * I, IndexPtr = uncheckedConvert(pointer, T2_), memory::setInteger64(IndexPtr, I), fail ; succeed. % I can call this on my laptop 10 million times in just over 3 seconds clauses fast_data_access() :- % simulating random access to get items I = std::downTo(9, 0), T1_ = uncheckedConvert(integerNative, ptr), T2_ = T1_ + sizeofDomain(integer64) * I, IndexPtr = uncheckedConvert(pointer, T2_), I64 = memory::getInteger64(IndexPtr), fail ; succeed. end implement memtest