No announcement yet.

Browse with DIM VIRTUAL and EMS

  • Filter
  • Time
  • Show
Clear All
new posts

  • Browse with DIM VIRTUAL and EMS

    I want to implement a procedure that allows me to visualize a file text without restrictions in size.
    The maximum width for line defines it he/she gives 236 characters. The procedure reads the text and it stores it in an array. How I can know the maximum size he/she gives the array that will depend he/she gives the quantity memory available EMS in the computer where this program is executed.
    The code that I use is:

    ems& = fre(-11)
    maxi??= (It is the maximum size that I should use)
    dim virtual text(1:maxi??) as string*236

    If I define a virtual array gives certain size and I execute fre(-11) again it returns me again the same quantity of memory. How can I know the


  • #2
    When the DIM VIRTUAL statement occurs, the memory is actually allocated, but in some circumstances the value returned by FRE(-11) will appear to be unchanged.

    The answer is quite simple: FRE(-11) has a maximum return value of 16Mb, but your memory manager may be able to supply much more EMS than that value. In this case, the value returned by FRE(-11) will only drop when the true amount of free EMS is lower than 16Mb.

    In other words, if FRE(-11) reports 16Mb, then it is possible that more than 16Mb is actually available. For example, some versions of QEMM can provide up to 64Mb of EMS, however, there is no (as I understand it) standard way to get this value from the wide variety of memory managers that are available, hence the 16Mb return value of FRE(-11).

    An individual VIRTUAL array can be up to 32Mb in size, so you can get two 32Mb arrays in 64 MB of EMS, or four 16Mb arrays, or one 32Mb plus two 16Mb, etc.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]