[Coco] Howto for Altera DE1?

Aaron Wolfe aawolfe at gmail.com
Sun Jul 4 16:18:40 EDT 2010


On Sun, Jul 4, 2010 at 9:56 AM, Steven Hirsch <snhirsch at gmail.com> wrote:
> On Sun, 4 Jul 2010, Steven Hirsch wrote:
>
>>>
>>> Exception in thread "dwproto-0-8"
>>> java.lang.ArrayIndexOutOfBoundsException: 222880
>>>       at
>>> com.groupunix.drivewireserver.dwprotocolhandler.DWDisk.loadSectors(DWDisk.java:283)
>>
>> 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

You'll find that many settings are "hard coded".   This is typical of
code I plan to replace and do not want to expose a setting into the
config which will become unnecessary.  Plan on doing simple edits to
the source if you want to experiment.

>
> 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.
>

I originally wrote it to use memory mapped files.  That works OK for
local things, but when you consider that we can mount disks from web
sites, ftp sites, via ssh, even from inside a zipped tar file on a
remote server... there has to be some cache to contain the image.
Some protocols/mechanisms simply do not allow random access, and
performance on things like web disks without a local cache can be
miserable.

I'm not happy with the current solution to this problem, which is an
in memory array of sector objects (the sector data and some control
info used by the lazy writer).  Feel free to implement an improved
version, but let me know if you do, since I'll probably be rewriting
it myself someday otherwise.


>
>
> --
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>



More information about the Coco mailing list