Hello Thomas,
just a little thing I found in upgrading my code to VIP 9:
In the declaration of predicate memory::allocHeap/3-> the (I suppose intended) default for ContextType is missing.
-
- VIP Member
- Posts: 354
- Joined: 14 Nov 2002 0:01
memory::allocHeap/3->
Regards Martin
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
Re: memory::allocHeap/3->
Actually, it is not possible to supply a default value to that predicate, because then it would conflict with allocHead/2->.
Regards Thomas Linder Puls
PDC
PDC
-
- VIP Member
- Posts: 354
- Joined: 14 Nov 2002 0:01
Re: memory::allocHeap/3->
Yes, I see.
It came to my attention because my calls in VIP 8 to
needed to be modified for VIP 9.
It came to my attention because my calls in VIP 8 to
Code: Select all
predicates
allocHeap : (byteCount Size, boolean Atomic) -> pointer Block.
Regards Martin
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
Re: memory::allocHeap/3->
Yes, that is unfortunate.
I don't know what you are allocating. But you should notice that many things can be allocated using these polymorphic predicates:
I don't know what you are allocating. But you should notice that many things can be allocated using these polymorphic predicates:
Code: Select all
predicates
alloc_kind : (memoryKind MemoryKind, context ContextType = contextType_pfc)
-> PointerType Allocated.
% @short Allocates an array of #PointerType with #Count elements.
% #Allocated points to the first element in the array. The memory is cleared.
% @end
predicates
alloc_kind_array : (memoryKind MemoryKind, positive Count, context ContextType = contextType_pfc)
-> PointerType Allocated.
% @short Allocates an array of #PointerType with #Count elements.
% #Allocated points to the first element in the array. The memory is cleared.
% @end
predicates
alloc : (context ContextType = contextType_pfc) -> PointerType Allocated.
alloc_atomic : (context ContextType = contextType_pfc) -> PointerType Allocated.
alloc_uncollectable : (context ContextType = contextType_pfc) -> PointerType Allocated.
% @short Allocates a value of #PointerType. The memory is cleared.
% @end
Regards Thomas Linder Puls
PDC
PDC
-
- VIP Member
- Posts: 354
- Joined: 14 Nov 2002 0:01
Re: memory::allocHeap/3->
'My' use of memory::allocHeap is in a customized version of arrayM. In arrayM.pro you have changed the call in VIP 9 to
And so did I in my customized version 
The customized copy of the arrayM class is of course not really part of the pfc. So would another context type suite better for me? Is there a context number range intended/reserved for being defined in applications?
Code: Select all
data := memory::allocHeap(ByteSize, ma:isAtomic, memory::contextType_pfc)

The customized copy of the arrayM class is of course not really part of the pfc. So would another context type suite better for me? Is there a context number range intended/reserved for being defined in applications?
Regards Martin
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
Re: memory::allocHeap/3->
Memory contexts are only interesting if and when you use the memory profiler. And you can easily track down your allocations and change context (which is typically something you do anyways when you are profiling).
I.e. it is not very important which context you use.
I.e. it is not very important which context you use.
Regards Thomas Linder Puls
PDC
PDC