bugKawa - Bugs: bug #15876, Ports are not reclaimed...

 
 

bug #15876: Ports are not reclaimed automatically when becoming inaccesible

Submitter:  None
Submitted:  Thu 23 Feb 2006 01:40:21 AM UTC
   
 
Category:  Scheme library Severity:  3 - Normal
Item Group:  Unexpected result Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 12 Dec 2006 07:00:09 PM UTC, comment #4: 

I checked in a fix so WriterManager uses WeakReference.

Per Bothner <bothner>
Group administrator
Thu 09 Mar 2006 06:08:52 AM UTC, comment #3: 

Yes, that works.  Thanks.

Anonymous
Sat 04 Mar 2006 07:48:17 PM UTC, comment #2: 

I believe this was fixed in CVS by this change:

2005-12-21  Per Bothner  <per@bothner.com>

  • OutPort.java (closeOnExit): New method.

(<init>): Only register with WriterManager if closeOnExit().

  • CharArrayOutPort.java (closeOnExit): New method - returns false.

This fixes a memory leak - CharArrayOutPort were not being collected.

Now it might also be worth considering using weak references in WriterManager.  But in any case could you check whether the 2005-12-21 change fixes the problem for you?

Per Bothner <bothner>
Group administrator
Fri 24 Feb 2006 06:54:51 PM UTC, comment #1: 

Looks like WriterManager keeps strong references to the ports.  Maybe it should keep weak references?

Anonymous
Thu 23 Feb 2006 01:40:21 AM UTC, original submission:  

The following will throw an OutOfMemoryError if the port
is not explicitely closed.

  (let ((build-string
           (lambda ()
             (let ((op (open-output-string)))
               (let ((str (get-output-string op)))
                 ;;(close-output-port op)
                 str)))))
     (do (((i :: <int>) 1000000 (- i 1))
          (x (build-string) (build-string)))
         ((< i 0) x)))

The documentation says:

      The port can be closed by the procedure close-output-port,
      though its storage will be reclaimed by the garbage collector
      if it becomes inaccessible.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2006-12-12 bothner StatusNone Fixed
        Open/ClosedOpen Closed
    2006-03-04 bothner Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code