On 4/18/07, Ivan Raikov <[EMAIL PROTECTED]> wrote:
One thing I could not understand from your description is that you say no garbage collector is used, but dynamically allocated data are reference counted. What exactly does that mean? Do you care to elaborate on how storage is handled in Crunch? I ask because if I end up seriously using crunch, I might be interested in using it with a custom memory allocator interface, such as libarena:
Data buffers (SRFI-4 vectors and strings) are allocated via "crunch_malloc" (defaults to malloc(3), but can be redefined by a macro) and freed using "crunch_free". A buffer is a structure containing a pointer to the actual storage, a pointer to ref-count cell and the length and are passed by value throughout the generated code. Using copy-constructors and overloaded assignment operators the ref-count is maintained. Since there are no nested data structures (only number vectors), circular structures are not a problem. BTW, the template code in crunch.h is likely to be pretty naive. I'm not a C++ guru. I'm sure there is a lot fo room for improvement. cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
