home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / pascal / 4883 < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.6 KB  |  52 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!mast.queensu.ca!dmurdoch
  3. From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
  4. Subject: Re: Expanded memory and the heap...
  5. Message-ID: <dmurdoch.35.714057983@mast.queensu.ca>
  6. Lines: 40
  7. Sender: news@knot.ccs.queensu.ca (Netnews control)
  8. Organization: Queen's University
  9. References: <1992Aug15.163435.25855@iitmax.iit.edu>
  10. Date: Mon, 17 Aug 1992 13:26:23 GMT
  11.  
  12. In article <1992Aug15.163435.25855@iitmax.iit.edu> bruifal@elof.iit.edu (Falke Bruinsma) writes:
  13. >
  14. >I am writing a program that needs huge amounts of memory, at this moment 
  15. >around 700K. Basically it is one huge tree and I add new records to it
  16. >by the following command NEW(ptr); However around the 600K (you guessed it)
  17. >I get a heap overflow... Since I do have expanded memory I as wondering if
  18. >someone can help me write a unit that makes the expanded memory an extension
  19. >of the heap. So that the program accesses expanded memory whenever the heap
  20. >is full. 
  21.  
  22. It's not too difficult to put the EMS page frame into the heap, if 64K more 
  23. memory would be enough; Compuserve has a program that does this, and also 
  24. any other "high" memory that it can find.  That's usually not much more than 
  25. 100K though.
  26.  
  27. If you really want full access to your EMS, you need some sort of paging 
  28. scheme.  I saw an ad once that a German company called OKSoft (sp?) had a 
  29. package that patched itself into the TP compiler and made this automatic, 
  30. but I've never heard anything more about that in the last year or so.
  31.  
  32. If you want to write it yourself, it's probably not practical to make the 
  33. paging transparent.  The best approach is probably to use "handles"; instead 
  34. of pointing to the thing you've allocated, they point to a record saying 
  35. where to find it.  You write procedures to dereference a handle by checking 
  36. the record and loading the thing if necessary.  It gets complicated if you 
  37. want to be able to dereference several handles at once, because they might 
  38. not all fit in memory at the same time.
  39.  
  40. A simpler approach which might well be good enough, is to keep your data on 
  41. a stream.  Use Seek, Read and Write every time you want to access or change 
  42. it.  Then you can have as much data as you have disk space, and if you've 
  43. got enough EMS to hold the whole dataset, you can load it into an EMS stream 
  44. and get the speed boost.  I've been using this method lately, and living 
  45. with the relatively slow access.  I use a TempStream from my Streams
  46. unit; that automatically chooses between RAM, EMS, XMS and disk, 
  47. according to priorities you set.  Streams is available as garbo.uwasa.fi:/pc/
  48. turbovis/stream13.zip by ftp.
  49.  
  50. Duncan Murdoch
  51. dmurdoch@mast.queensu.ca
  52.