Memory: how much left?

new topic     » topic index » view thread      » older message » newer message

I had thought that Dechesnes's function FreeXMS() (in memory.e) would
help me know how much memory I have left. My problem is that I have to
keep as much data in memory to speed up computations. However, when I
load just a little too much, Euphoria starts using virtual memory and
my software crawls to a virtual (!) halt: 70 seconds where 0.7 used to
do the job. Typically, I keep data sets loaded from disk as members
of a sequence, and I periodically remove from the sequence those sets
least accessed. Since they vary in size considerably I had until now
to take an educated guess (read: hit-and-miss) as to how many I
could fit without Euphoria using virtual memory. I discovered
memory.e, and thought my problems would be over. All I had to do
was call FreeXMS() regularly, and shrink the sequence of data sets
when memory became low. Alas, after shrinking, a call to FreeXMS
returns the same amount of free memory as before shrinking. Yet,
periodically shrinking my sequences prevents Euphoria resorting
to virtual memory. So, Euphoria must know something that FreeXMS
doesn't, or...?

Here is  a example:

include memory.e

sequence list
list={}
printf(1,"\nFreeXMS=%d",FreeXMS())
for i=1 to 50000 do
  list=append(list,rand(1000))
end for
printf(1,"\nAfter appending: %d",FreeXMS())

list={}
printf(1,"\nAfter list={}: %d",FreeXMS())

I am lost. All I want to do is avoid the use of virtual
memory. Is there any way of telling when Euphoria is
about to resort to virtual memory?

Thanks in advance.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu