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

saving applications



   From: kumyew@EAGLE.MIT.EDU (kumyew)

   1.  some saved applications crash.  I suppose
   this is due to pointers to the heap that I
   haven't deallocated before saving.  IS THERE
   A PROGRAMMATIC WAY TO DEALLOCATE ALL POINTERS?
   There's a ccl::kill-lisp-pointers function, but
   it seems undefined (even if I provide the full
   package name).

there is no programmatic way to do this.

The best thing to do is to have clear installation/deinstallation
protocols.  For example, every WINDOW has a WPTR.  When the window
is closed, the WPTR is deallocated.  It's easy to keep track
of windows, and close them all at save application time.

In a similar vein, dialog-items only have handles when they are
installed in a window.  If you remove the item from a window,
the handle is deallocated.  If you add it back, a new handle
is allocated.  If the item is in a window, the window points
to it, and it won't be GC'd.  If the item is not in a window,
it can be GC'd (but the pointer has already been deallocated).
When you close a window, the window first removes all the
dialog items, thus disposing of their pointers.

Modularity techniques like this make it much easier to track
Macintosh pointers.


   2.  MACROS DON'T SEEM TO WORK.  For instance,
   I used (save-application <filename>) in a fresh
   Lisp listener.  The standalone application is
   given the following as the first 2 lines:

   (setf temp '(a b))
   '(A B)

   (setf (getf temp 'c) 'd)
   > Error: NIL can't be FUNCALLed or APPLYed.
   > While executing: CCL::READ-LOOP
   > Type Command-/ to continue, Command-. to abort.

You have to make sure that this code is fully compiled
before you save the application.  It might be best to
put it in a compiled startup function, and call
that function.

    -andrew