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

Bug#509803: Fails to properly free memory on exit



Package: ocaml
Version: 3.10.2-3
Severity: normal

Hi,

I wrote some bindings for libaio using custom blocks for the C
structures I need to allocate for the internal state and buffer. I
also wrote *_finalize(value) functions for them so they get properly
cleaned up when no longer in use.

I assumed that when the program exits normaly that all memory will be
freed, specifically that *_finalize(value) is called for all custom
blocks in case they have to do some custom cleanup. Unfortunately that
is not the case.

In my case I want to make sure there are no pending IO operations left
in the queue when the program exits, specially no write operations
still waiting to complete, as otherwise there might be data lost.
Other uses for this could be removal of temp files, logging out from
network connections (ftp, databases, ...), freeing of IPC resources
and many more.

Without ocaml calling the finalizer at exit one has to manually track
allocated custom blocks causing 16 bytes (prev/next pointer) overhead
per block and implement ones own cleanup code by using atexit() in an
initializer, which is rather ugly.

Please forward this upstream so ocaml can be made to call the
finalizers at exit.

MfG
	Goswin

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-xen-frosties-1
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages ocaml depends on:
ii  libx11-dev                    2:1.1.5-2  X11 client-side library (developme
ii  ocaml-base                    3.10.2-3   Runtime system for OCaml bytecode 
ii  ocaml-nox                     3.10.2-3   ML language implementation with a 

ocaml recommends no packages.

Versions of packages ocaml suggests:
ii  tcl8.4-dev                    8.4.19-2   Tcl (the Tool Command Language) v8
ii  tk8.4-dev                     8.4.19-2   Tk toolkit for Tcl and X11, v8.4 -

-- no debconf information



Reply to: