[REBOL] Rebol Memory Allocation Strategy?
From: tim::johnsons-web::com at: 21-Sep-2002 9:12
Hello All:
I need clarification on rebol memory allocation. I
programmed in C and Asm for years so am cognizant of
architectural approaches to memory allocation (well, sort
of). Let's say we have a function
my-f: func[][str: make string! 8192 ; untested code
; appends much data to str....
]
and that function is called any number of times.
Now, does that mean that rebol has to allocate 8092 bytes
of memory every time that 'my-f is called?
==>>If that is so then would not the following be more
efficient?
my-obj: make object![ ; untested code
str: make string! 8192
_my-f: func[][
clear str
; appends much data to string...
] ; end function
] ;end object
Would not 'str be allocated just once and that would
be during evaluation of my-obj?
Then 'my-f would only have to reset the "internal data
pointer" which is trivial in terms of overhead.
(presuming my-f would be 'happy' with 8192 bytes)
Comments, nags criticisms appreciated..
TIA
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com