[REBOL] Re: callbacks
From: moliad:gm:ail at: 6-Nov-2007 10:15
Lad,
I allocate nothing, its a callback. the lib calls my func. I never build a
struct except to supply the callbacks upon loading the lib, and that is
safe.
Maybe its possible the gc could recycle in the window of time in between
change pointer address and doing the copy, but if this is the case, both
versions I guess suffer the same fatality. maybe adding a recycle/off
recycle/on pair within the func could prevent this possibility.
previously, anytime the GC would pick up the struct it would crash. Delay
was no issue, the stuct really is left corrupted, my guess is that the GC
attempts a free() on the memory pointed to by address. There are a few
reasons why structs could actually be allocated manually, outside of the
normal recycling pool, and since there is a GC managing the struct rebol
wrapper anyways, the rule that everything eventually gets freed is still
applicable.
wrt speed, my tests where within my whole environment. I'm sorry if a pure
test shows you're function almost twice as fast, and I insinuated otherwise.
just a question, can you add a to-binary to your memcopy and see the speed
impact that has? cause your function returns a string. I don't expect it
to be major, but with REBOL I don't assume anything anymore. I'm just
curious.
-MAx
On 11/6/07, Ladislav Mecir <lmecir-mbox.vol.cz> wrote: