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

Problem in arrayM resp. memoryAccessor

Post by Martin Meyer »

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: 354
Joined: 14 Nov 2002 0:01

Post by Martin Meyer »

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
You do not have the required permissions to view the files attached to this post.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1466
Joined: 28 Feb 2000 0:01

Post by Thomas Linder Puls »

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