dillon@PAVEPAWS.BERKELEY.EDU (Matt Dillon) (07/08/86)
I have definately found a bug in the RAM: device for 1.2 B II. Here's the pitch: blockwrite is a program which takes two arguments. Argument #1 is the number of blocks to write. Arg number #2 is the blocking factor for Write() (what size chunks to write at a time). it creates the file: ram:ramtest scenario: % mem 236232 % blockwrite 500 1 ok % mem 228120 % dir ram: rwxd 500 ramtest TOTAL: 500 % blockwrite 500 500 ok % mem 235648 % dir ram: rwxd 500 ramtest TOTAL: 500 got the idea? using a blocking factor of 1 instead of 500 takes more memory for some reason, even though the file size is the same. Using a file size of 5000, the problem becomes more apparent: blocking of 512: memory free 225K blocking of 1: memory free 152K some difference, eh? So what happens when my modem program Capture's a 20K file to the ram: disk, writing in blocks of < 32 bytes (or whatever..)??? I run out of memory, that's what happens. Here is the blockwrite.c program: /* * BLOCKWRITE.C * * To test a bug in the RAM: drive. This program will create the file * 'ramtest' on the ram drive of a given number of bytes using a given * block size to Write(). * * * blockwrite bytes blocksize * */ extern char *AllocMem(); main(ac, av) char *av[]; { int bytes, blocksize, fh; char *buf; if (ac == 3) { bytes = atoi(av[1]); blocksize = atoi(av[2]); } else { bytes = blocksize = 0; } if (bytes < 1 || blocksize < 1) { puts ("blockwrite bytes blocksize"); puts ("blockwrite 20000 1"); exit (1); } if (buf = AllocMem(blocksize, 0)) { if (fh = Open("ram:ramtest", 1006)) { /* NEWFILE */ while (bytes > blocksize) { Write(fh, buf, blocksize); bytes -= blocksize; } Write(fh, buf, bytes); Close(fh); } FreeMem(buf, blocksize); } puts ("ok"); }