Re: Segmentation fault using (get-internal-info)

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Sun, 26 Feb 1995 11:26:09 +0000

> a bug was found in STk 2.1.6 on SunOS4.1.3_U1 compiled using gcc 2.5.8.
>
> A segmentation fault error can be obtained calling the function
> (get-internal-info). I have found the problem using STk statically linked
> with my own extensions, but the problem occurs also with the released version.

OOPS.. Heerafter is a working version of this procedure (located in
Src/slib.c)

PRIMITIVE STk_get_internal_info(void)
{
  SCM z = STk_makevect(7, NULL);
  long allocated, used, calls;

  /* The result is a vector which contains
   * 0 The total cpu used in ms
   * 1 The number of cells currently in use.
   * 2 Total number of allocated cells
   * 3 The number of cells used since the last call to get-internal-info
   * 4 Number of gc calls
   * 5 Total time used in the gc
   * 6 A boolean indicating if Tk is initialized
   */

  STk_gc_count_cells(&allocated, &used, &calls);

  VECT(z)[0] = STk_makenumber(STk_my_time());
  VECT(z)[1] = STk_makeinteger(used);
  VECT(z)[2] = STk_makeinteger(allocated);
  VECT(z)[3] = STk_makenumber((double) STk_alloc_cells);
  VECT(z)[4] = STk_makeinteger(calls);
  VECT(z)[5] = STk_makenumber((double) STk_total_gc_time);
#ifdef USE_TK
  VECT(z)[6] = Tk_initialized ? Truth: Ntruth;
#else
  VECT(z)[6] = Ntruth;
#endif
  
  STk_alloc_cells = 0;
  return z;
}



                -- Erick

                -- Erick
Received on Sun Feb 26 1995 - 11:37:50 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST