Problem in arrayM resp. memoryAccessor

Discussions related to Visual Prolog
Martin Meyer
VIP Member
Posts: 291
Joined: 14 Nov 2002 0:01

Problem in arrayM resp. memoryAccessor

Unread post by Martin Meyer » 14 Feb 2016 13:27

Hello Thomas,

please check below code. It throws an access violation (in VIP 7.5.0.2).

Regards
Martin

Code: Select all

open core   domains     d = d(integer16).   clauses     run() :-         ArM = arrayM::newNonAtomic(1),         ArM:set(0, d(1)),         D = ArM:get(0),         stdIo::write(D).

Martin Meyer
VIP Member
Posts: 291
Joined: 14 Nov 2002 0:01

Unread post by Martin Meyer » 14 Feb 2016 15:56

Please also have a look at the enclosed project. It contains a modified version of arrayM named dynArrayM. I am not sure, whether its memory access is correct and optimal, but it does not throw that exception.

Whenever the array's field type is nonatomic, dynArrayM allocates space of size of domain pointer (i.e. 4 resp. 8 bytes) for every field. Is that wasteful?

Many regards
Martin
Attachments
DynArrayM.zip
(8.52 KiB) Downloaded 280 times

User avatar
Thomas Linder Puls
VIP Member
Posts: 1625
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 15 Feb 2016 10:36

Hi, Martin. We will look at the problem.
Regards Thomas Linder Puls
PDC

Post Reply