chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Implementing buffer gap


From: felix winkelmann
Subject: Re: [Chicken-users] Implementing buffer gap
Date: Tue, 28 Dec 2004 22:17:33 +0100

On Tue, 28 Dec 2004 21:11:23 +0000, Joel Reymont <address@hidden> wrote:
> > felix winkelmann wrote:
> > [...]
> >#;3> (move-memory! (make-locative x 5) (make-locative x 18) 2)
> 
> Would it be better to use make-weak-locative?

make-weak-locative is a likely alternative, it just depends on your
needs - if the locative is likely to exist longer that the buffer it refers
to, a weak locative would not prevent the buffer from being garbage
collected.

> 
> Also, is there a vector-resize specific to byte vectors? It seems that if
> I used vectors then I could do vector-resize to make my buffer bigger. I
> can't seem to find how to do that for byte vectors.
> 
> Or should I just use a vector to store characters in my buffer?
> 

Byte-vectors are much more memory efficient, so I recommend using
those. If you want to resize your buffer, the easiest way might be to
create a new buffer and copy the old contents into that one (and
swap the buffers in the end).


cheers,
felix




reply via email to

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