Package: libcairo-ocaml-dev
Version: 20070908-1+b2
Severity: normal

OCaml programs which create Cairo surfaces via Cairo_bigarray leak memory.
Following test program reproduces the bug. The program allocates many 100Mb arrays, but explicit garbage collector invocation should keep the total memory usage low.


$ cat bug.ml
#use "topfind"
#require "bigarray,cairo"

open Bigarray

let test () =
  let u = Array2.create int8_unsigned c_layout 10000 10000 in
  ignore (Cairo_bigarray.of_bigarr_8 u)

let () =
  for k = 1 to 100 do Gc.compact (); test () done

$ ocaml bug.ml
Out of memory during evaluation.


It seems that the OCaml runtime does not free memory associated with the bigarray "u". Curiously, following program works as expected. Note the last line of function "test", which prevents deallocation of the bigarray in preceding GC run.


$ cat nobug.ml
#use "topfind"
#require "bigarray,cairo"

open Bigarray

let test () =
  let u = Array2.create int8_unsigned c_layout 10000 10000 in
  ignore (Cairo_bigarray.of_bigarr_8 u);
  Gc.compact ();
  ignore u

let () =
  for k = 1 to 100 do Gc.compact (); test () done

$ ocaml nobug.ml
(no output)




-- System Information:
Debian Release: 5.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.29-mrkev (SMP w/2 CPU cores)
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libcairo-ocaml-dev depends on:
ii  libcairo-ocaml             20070908-1+b2 OCaml bindings for Cairo
ii  libcairo2-dev              1.6.4-7       Development files for the Cairo 2D
ii  liblablgtk2-ocaml-dev      2.10.1-2      OCaml bindings to Gtk+ version 2
ii  ocaml-nox [ocaml-nox-3.10. 3.10.2-3      ML language implementation with a

libcairo-ocaml-dev recommends no packages.

Versions of packages libcairo-ocaml-dev suggests:
ii  ocaml-findlib                 1.2.1-5    Management tool for OCaml programm

-- no debconf information



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to