AR 59343.
-----Original Message-----
From:
[hidden email] [mailto:
[hidden email]] On
Behalf Of Nicolas Cellier
Sent: Thursday, January 21, 2010 5:21 AM
To:
[hidden email]
Subject: [vwnc] [BUG] copyToHeap:
#copyToHeap: generally allocate too much memory.
This is an old bug not corrected in VW7.7 (never detected ?).
This is due to #malloc: and #gcMalloc: taking NUMBER OF ELEMENTS as
argument ... (rather than NUMBER OF BYTES) But some implementation of
#copyToHeap: pass the number of bytes.
For example, a corect version for DWordArray should be:
DWordArray>>copyToHeap: mallocSelector
| aPointer byteSize numElements |
byteSize := self basicSize.
numElements := byteSize / self baseCType referentType dataSize.
aPointer := self baseCType referentType perform: mallocSelector
with: numElements.
aPointer
copyAt: 0
from: self
size: byteSize
startingAt: 1.
^aPointer
Allocating too much memory is less desastrous than too few :) But
hungriest memory eaters might like to patch
Cheers
Nicolas
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc