28 Nov
2003
28 Nov
'03
3:14 p.m.
On Fri, Nov 28, 2003 at 12:37:30PM +0100, Wolfgang Jeltsch wrote:
So, what is happening that there is 1 cell in the heap containing the representation of 'a', and then a linked list of length 5000000, where each element points to that cell.
Yes, you're right. But if you choose the array alternative, you cannot use sharing and would, therefore, still need 20 MB.
You can use sharing if you don't use unboxed arrays. Not that it matters if a character takes as much space as a pointer, but for 64-bits floating point numbers on a platform with 32-bits pointers, it would decrease memory consumption by almost half. Anyway, I'm just nitpicking. :-) -- Sebastien