Re: Constant IDE crashes
Roger Corman <[email protected]> Wed, 02 Apr 2003 11:56:34 -0800
| Newsgroups | gmane.lisp.corman |
|---|---|
| Message-ID | <[email protected]> |
Regarding your question about whether freeing memory is required:
The garbage collector will automatically free any memory allocated via ct:malloc so you do not usually need to call ct:free. In fact, it is usually safer not to (in case pointer is inadvertantly shared).
The only time I know that ct:free is useful is when you have allocated a large block and wish to immediately free it, or if the garbage collector is not running enough to keep the c heap size down. For example, if you allocate foreign heap blocks in a loop, without also allocating lisp heap, the garbage collector may not run for a long time, and the c heap blocks pile up. Also, once a c heap block makes its way into the oldest generation heap, it will not be freed until that level of GC is called (gc 2) which may not happen often.
I suspect the problems have to do with Open GL usage--I say this mainly because I have done some small things with it and I remember getting crashes as well. Although freeing memory is not required, it may be necessary to free resources which are implicitly or explicitly called when using Open GL. I can't offer more detail than this because I don't know Open GL, but I would see if you can track down what is causing the problem by eliminating OpenGL calls. Also, you can try running from the console (clconsole.exe) and see if you still get the crashes. If you think an interaction with the IDE may be happening this should determine that.
Roger
-----------------------------------------------------------------
At 08:19 AM 4/2/2003 +0000, you wrote:
>Since I am experiencing constant IDE crashes after one or two
>executions of a small app I am working on, I was wondering if not
>freeing memory that has been allocated using (ct:malloc) has any
>effect on CCL. I.E, I don't free any memory between runs of my app.
>A couple of runs later and the CLL IDE either crashes outright, or
>hangs.
>
>In one case I use a hashable to store C arrays containing OpenGL
>color RGB values. (Q: How do you iterate though each entry in a hash
>table, setting each slot to (ct:free)) ?
>
>It's a small OpenGL application that makes use of the SDL library
>(www.libsdl.org). I have been working on the FFI definitions to SDL,
>on and off for a while now. The FFI definitions run around 54KB,
>most of which had to be edited by hand, rewrite C macros etc. to get
>past limitations in the parser... e.g...
>
>//SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT)
>#LISP (progn
> (export 'SDL_ACTIVEEVENTMASK)
> (defun SDL_ACTIVEEVENTMASK ()
> (SDL_EVENTMASK SDL_ACTIVEEVENT)))
>
>... is an example, oh and having to rewrite several hundred key
>mappings is always fun...
>
>typedef enum {
> /* The keyboard syms have been cleverly chosen to map to
>ASCII */
> SDLK_UNKNOWN = 0,
> SDLK_FIRST = 0,
> SDLK_BACKSPACE = 8,
> SDLK_TAB = 9,
> SDLK_CLEAR = 12,
> SDLK_RETURN = 13,
>
>... become ...
>
>#LISP (win:defwinconstant SDLK_UNKNOWN 0)
>#LISP (win:defwinconstant SDLK_FIRST 0)
>#LISP (win:defwinconstant SDLK_BACKSPACE 8)
>#LISP (win:defwinconstant SDLK_CLEAR 12)
>#LISP (win:defwinconstant SDLK_RETURN 13)
>#LISP (win:defwinconstant SDLK_PAUSE 19)
>#LISP (win:defwinconstant SDLK_ESCAPE 27)
>
>...
>
>Anyway, the application displays a multicolored cube in a window,
>clicking any mouse button rotates the cube about the Y axis.
>
>The application runs fine under XP (actually, in the previous
>version of CLL, the application would run, but then generate an
>exception on exit). Under NT/98, the application runs but the window
>will not close after the program exits. Under 95 the application
>will not run at all.
>
>If anyone is interested I can email you my SDL FFI definitions, my
>expanded Opengl FFI definitions (all of v1.1), and my OpenGL example.
>
>
>
>
>To unsubscribe from this group, send an email to:
>[email protected]
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/SyjtlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/