Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A string bug in 1.2.8-s682 (*solved*)
#12
Darkstar Wrote:
boriel Wrote:The heap es automatically defragmented on each free operation, if possible. Compacted means all blocks must be moved down, the free-list updated and compacted and also locate each declared string var (ponter) in memory and update it accordingly. The problem is: this is an expensive (time/space) function for the speccy, must be done dynamically and you will probably end wasting more space compiling that function that the memory you want to free in a 48Kb system. :|
QuickBasic did it's own garbage collection but you could force it if needed.
Defragmentation and compacting goes hand in hand as I understand it. If the
compiler does it's own defragmentation/compacting upon each free operation
then it would not be so big of a deal to make that avialible to the ZX BASIC
programer provided that it's modular enough. This is always an expensive
operation in computing and thus you can force it under idle circumstances.
Not exactly. I implemented a heap (usually used in legacy C/Pascal compilers) which only gives memory blocks and maintain a linked list of free ones. This is a very common heap, specially indicated for systems with little memory or embedded systems, etc. A Garbage collector might need much more metadata to be maintained, and variables also need to be referenced (probably with a ref counter, etc). This is implementation is pretty straight (faster and lighter). There are some optimizations that can be done. E.g. A$ = A$ + B$ could be detected and compiled as A$ += B$; (+= operator is not supported). Which could be compiled as a REALLOC followed by a concatenation. REALLOC routine is implemented, and reduces fragmentation.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)