I tried a quick experiment where I thought I would create a mapped file,
allocate maximum, close the file, expand the file, and then reoppen it.  My
assumption was that when the file was reopenned that I'd be able to allocate
two more values (each value takes 8 bytes).  However, instead I get an 'bad
jmf header' error.  Is this just an assertion (i.e. people wont normally do
this), or is there an underlying reason why I shouldn't do it this way?

This example probably seems a bit pointless.  In practice I was thinking
about allocating in blocks of n, and then expanding as necessary via some
routine (copy to new or append).   My motivation was to save disk space, and
also, to discover what the most efficient way to expand mapped file is.

thanks,
-Steven

require'jmf'
jdatafn3=: jpath '~temp\jdata3.jmf'
createjmf_jmf_ jdatafn3;1000  NB. 1000 bytes for data
jdata3 =. i.125
map_jmf_ 'jdata3';jdatafn3

unmap_jmf_ 'jdata3'

Subsequently I tried to make the file 16 bytes larger:

'1234567812345678' fappend jdatafn3    NB. append 16 bytes

map_jmf_ 'jdata3';jdatafn3                NB. map file again

|bad jmf header: assert
|   'bad jmf header'    assert 0[free fh,mh,fad
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to