[Coco] Howto for Altera DE1?
Lothan
lothan at newsguy.com
Sun Jul 4 16:32:55 EDT 2010
Wouldn't it be better to use a dynamically-sized array or perhaps
List<DWDiskSector> than allocating the maximum theoretical disk size for
each image? If you use an array, you'll have to calculate the size of the
array prior to allocation. If you use a List<DWDiskSector>, the array can be
allocated on the fly as you add items to the list.
--------------------------------------------------
From: "Steven Hirsch" <snhirsch at gmail.com>
> On Sun, 4 Jul 2010, Steven Hirsch wrote:
>
>> Ding! Here's the problem:
>>
>> ----------------------- cut here --------------
>>
>> public class DWDisk {
>>
>> ...
>>
>> public static final int MAX_SECTORS = 122880; // what is coco's max? 24
>> bits?
>>
>> ....
>>
>> private DWDiskSector[] sectors = new DWDiskSector[MAX_SECTORS];
>>
>>
>>
>> ----------------------------------------------
>>
>> Looks like a hard-coded assumption about maximum sector offset. I'll try
>> bumping that up and rebuilding.
>
> Ok, I had to increase that to 516096 to allow for a 128MB disk image.
> With all of the disk buffers allocated on the heap, the process starts to
> use a lot of memory.
>
> Is it possible to deal with memory-mapped files in Java? That might be a
> more elegant way to do this than a literal heap-allocation.
More information about the Coco
mailing list