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

Re: Errors



jipan@gmuvax2.gmu.edu (Jiqian Pan) writes:
> Sometimes the moving of objects works very well, but sometimes does not.
> First, I got a sign of "GC" on the screen, then the system crashed.
> Finally I got "an error of type 25 occurred" on the screen.

This error frequently occurs when records are not properly disposed
(dispose-record) before reallocating them (make-record). One way
to avoid this problem is to use the rlet macro which allocates
temporary records on the heap and removes them after the form is
executed.

For permanent variables, you could first check to see whether they are
records, release the storage and then allocate new storage:
   (defparameter my-rect (make-record :rect))

   .....
   ;;  attempt to assign a new record to my-rect
   (when (and (boundp 'my-rect) my-rect (zone-pointerp my-rect))
      (dispose-record my-rect :rect))
   (setq my-rect (make-record :rect))

Mark