Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Allocating a variable length array
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
GTBecker



Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral

Posted: 17 September 2006, 15:48 PM    Post subject: Allocating a variable length array Reply with quote

Quote:
... fails because there is not a single contiguous block of free memory...

The same situation occurs in file management. Defrag became a verb when
Microsoft made us do it. XP does it continually. All you need is a
hyper-speed memory manager that runs transparently.

Can you have that by Tuesday, Don?


Tom
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 17 September 2006, 16:13 PM    Post subject: Re: Allocating a variable length array Reply with quote

GTBecker wrote:
The same situation occurs in file management.

Although the idea is similar, it's not quite the same thing. With disk space allocation, there is usually a virtualization layer that maps the contiguous sequence of bytes that comprise a file to the possibly discontiguous sectors on the disk where the bytes are actually stored. Fragmentation on a disk doesn't stop one from creating a file that uses the fragmented space, it just results in lower performance than could be obtained if the file were stored contiguously.

Although you could implement a similar virtualization layer for a memory allocator, I suspect that performance limitations would outweigh the benefit.

As is commonly done, the ZX allocator does combine adjacent free blocks in order to create the largest possible free blocks for future allocation requests.
Back to top
stevech



Joined: 23 Feb 2006
Posts: 688

Posted: 17 September 2006, 17:28 PM    Post subject: Reply with quote

does the VM's memory allocator try to merge returned adjacent blocks? I know this can get messy and time-consuming.

For our humble micros, I think it's best to use small blocks and don't vary the block size much.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 17 September 2006, 17:48 PM    Post subject: Reply with quote

stevech wrote:
does the VM's memory allocator try to merge returned adjacent blocks? I know this can get messy and time-consuming.

It does. It's not particularly difficult to do since, at most, three blocks need to be combined.

The heap is automatically expanded and contracted, too, as need be. The UnsignedInteger value Register.HeapEnd indicates the lowest address in the heap which grows from higher addresses toward lower addresses.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Goto page Previous  1, 2
Page 2 of 2

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group