From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: stefan Newsgroups: gmane.network.serveez.devel,gmane.lisp.guile.devel Subject: memory management Date: Tue, 18 Mar 2003 19:29:20 +0100 (CET) Sender: dev-serveez-bounces+gnu-dev-serveez=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1048013923 10088 80.91.224.249 (18 Mar 2003 18:58:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 18 Mar 2003 18:58:43 +0000 (UTC) Cc: Serveez Developer Mailing List Original-X-From: dev-serveez-bounces+gnu-dev-serveez=m.gmane.org@gnu.org Tue Mar 18 19:58:42 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18vMIL-0002cX-00 for ; Tue, 18 Mar 2003 19:58:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vMHi-0001FM-01 for gnu-dev-serveez@m.gmane.org; Tue, 18 Mar 2003 13:58:02 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18vMGu-0008Ex-00 for dev-serveez@gnu.org; Tue, 18 Mar 2003 13:57:12 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18vMGl-0007gc-00 for dev-serveez@gnu.org; Tue, 18 Mar 2003 13:57:07 -0500 Original-Received: from obh.snafu.de ([213.73.92.34]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vMGe-00077y-00; Tue, 18 Mar 2003 13:56:56 -0500 Original-Received: from p-164-211.zrz.tu-berlin.de ([130.149.164.211] helo=bono) by obh.snafu.de with asmtp (TLSv1:DES-CBC3-SHA:168) (Exim 3.36 #1) id 18vMGa-000B2o-00; Tue, 18 Mar 2003 19:56:54 +0100 Original-Received: from localhost ([127.0.0.1]) by bono with esmtp (Exim 3.36 #1) id 18vLpw-00015H-00; Tue, 18 Mar 2003 19:29:20 +0100 X-X-Sender: stefan@bono.reversers.net Original-To: guile-devel@gnu.org X-BeenThere: dev-serveez@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for the GNU serveez List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: dev-serveez-bounces+gnu-dev-serveez=m.gmane.org@gnu.org Xref: main.gmane.org gmane.network.serveez.devel:102 gmane.lisp.guile.devel:2086 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2086 Dear Guile'ers, the manual from HEAD branch CVS tells me to use scm_malloc() instead of scm_must_malloc() when allocating memory not connected to smobs. There is no scm_free(): > The memory is allocated by the libc @code{malloc} function and can be > freed with @code{free}. There is no @code{scm_free} function to go > with @code{scm_malloc} to make it easier to pass memory back and forth > between different modules. Can you plese explain what "make it easier to pass memory back and forth between different modules" means? What are modules in this context? Wouldn't it be more othogonal to supply a scm_free()? The actual reason I ask for the implementation of a scm_free() is as follows. I am a developer of Serveez. It uses Guile as configuration language and also as implementation language for quite some time. The software is portable to Win32. Thus we need Guile be portable to Win32. Lots of the changes in Guile CVS regarding Win32 portability were made by myself. On Win32 systems there is not such a thing like a standard libc. There are different APIs around, especially regarding memory management. When you use e.g. gh_scm2newstr() from an application linked against libguile.dll (which was ported using the msvcrt.dll - one of the libc's) and the calling application is linked against another libc (e.g. kernel32.dll only) which provides 'another' free() as the msvcrt.dll... it fails! This is bad I know, but not to work around... Would you supply a scm_free() inside libguile.dll there would be no problem, because then the free() called inside libguile.dll:scm_free() would match the previous malloc() (also called inside libguile.dll). In previous versions of Guile I helped myself calling scm_must_free() which sufficed for this purpose perfectly. Thanks in advance, stefan@lkcc.org PS: Please CC answers to my private email, because I wouldn't read the guile-devel list too regularily. PPS: I am waiting for the coop-thread thingie to have finsished in Guile devel to put the pending changes regarding Win32 portability into CVS...