[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: 10K GIFT FROM DOS



As I understand things, the reason you get 10K extra memory when you
shell-to-dos-and-return is the following: Like any program, XyWrite needs to
allocate chunks of memory as needed as you work with it. So when you add text,
move things around, switch between files, etc XyWrite grabs bits of memory to
accomplish it's goals. Normally, when you no longer need the memory it is
returned to the pool of available memory. Problem is, sometimes memory can get
"fragemented:" if XyWrite needs a 2K chunk of memory, it may overlook a 1 K
chunk which is "free" and grab a larger piece from the pool of available
memory.

When you "shell to dos", XyWrite busily collects thes unallocated chunks of
memory. In a process called "defragmentation" it shuffles things around so
that, to the greatest extent possible, all UNUSED memory lies in a continuous
chunk from the end of your data to the top of RAM. It does this so when you go
to DOS you have the maximum free memory available to run other programs. When
you return from DOS to XyWrite, this is reflected in the 10K available memory
you suddenly have rediscovered. It was there all along, its just that bits and
pieces of available memory needed to be collected first.

Hope this explanation helps.

By the way, in some application note or some comment on this BBS I recall
reading a comment to the effect that "to get the maximum amount of free memory,
shell to dos and then immediately return."

Steve Crutchfield