chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] *crunch*


From: felix winkelmann
Subject: Re: [Chicken-users] *crunch*
Date: Wed, 18 Apr 2007 08:23:40 +0200

On 4/18/07, Ivan Raikov <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]