🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #6265

Simulating virtual RAM in c++

#6265
From: David James Alexander Hanley
Date: Sun, 03 Jan 1993 10:05
41 lines
1777 bytes
  There is a project I have had in mind to try for some time but have not
started on it quite yet.  It would give you virtual arrays for data and
objects in c++ under plain ole MSDOS.  Here is the basic idea:

  There are some disk memory allocation functions.  They can be called on
to allocate, store, retreive, and free memory off a "disk heap".  There is
a cache that provides the possibility that some of this data will never
be written to the disk, and will just be allocated and freed.  This is
important.

  There are several templates for creating arrays and pointers.

  The arrays would work by overloading of the [] operator.  Writes to the
array would be written to the disk.  Reads would be read, and forked over.
I think this could be implemented for arrays, arrays of objects, and
to a lesser degree, pointers.

example:

#include "diskaray.h>

...

DISK_ARRAY<CUSTOMER_RECORD> records[ 10000 ];
CUSTOMER_RECORD record;
..

get_new_record( &record )

records[ x ] = record;
....
record = records[ y ];

Unfortunately, you can't access the array directly :
records[ a ].name;

  It isn't as pretty as pure virtual RAM, but this WILL work under ms-dos
in c++.  A similar trick could be written in C, pascal, or other languages,
I guess, but it (probably) wouldn't be as pretty.

  Ya know, this is a good idea.  I should do this.  When I have time...
Technical Details
Message-ID: <93003.040516U16244@uicvm.uic.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u16244

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u16244
Organization: University of Illinois at Chicago
Date: Sunday, 3 Jan 1993 04:05:16 CST
From: David James Alexander Hanley <U16244@uicvm.uic.edu>
Message-ID: <93003.040516U16244@uicvm.uic.edu>
Newsgroups: comp.os.msdos.programmer
Subject: Simulating virtual RAM in c++
Lines: 41