MPS issue job003338

TitleExample Scheme interpreter does not finalize ports
Statusclosed
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionThe example Scheme interpreter registers ports for finalization but does not finalize them. For example:

MPS Toy Scheme Example
The prompt shows total allocated bytes and number of collections.
Try (vector-length (make-vector 100000 1)) to see the MPS in action.
You can force a complete garbage collection with (gc).
If you recurse too much the interpreter may crash from using too much C stack.
9960, 0> (open-input-file "scheme.c")
#[port "scheme.c"]
10064, 0> (gc)
#[undefined]
Collection started.
  Why: Client requests: immediate full collection.
  Clock: 4375
Collection finished.
    live 10040
    condemned 10088
    not_condemned 0
    clock: 4775

I expect to see the message "Port to file "scheme.c" is dying. Closing file." as a result of the garbage collection, but it does not appear.
AnalysisFinalization messages need to be enabled by calling

mps_message_type_enable(arena, mps_message_type_finalization());

With that turned on, I see:

MPS Toy Scheme Example
The prompt shows total allocated bytes and number of collections.
Try (vector-length (make-vector 100000 1)) to see the MPS in action.
You can force a complete garbage collection with (gc).
If you recurse too much the interpreter may crash from using too much C stack.
9960, 0> (open-input-file "scheme.c")
#[port "scheme.c"]
10064, 0> (gc)
#[undefined]
Collection started.
  Why: Client requests: immediate full collection.
  Clock: 3401
Port to file "scheme.c" is dying. Closing file.
Collection finished.
    live 10040
    condemned 10088
    not_condemned 0
    clock: 3807
How foundmanual_test
EvidenceSee description.
Observed in1.110.0
Created byGareth Rees
Created on2012-10-22 15:52:53
Last modified byGareth Rees
Last modified on2012-10-22 15:54:20
History2012-10-22 GDR Created.

Fixes

Change Effect Date User Description
180008 closed 2012-10-22 15:54:20 Gareth Rees Enable finalization messages.
Rename entry_open_in to entry_open_input for consistency.
Add comments with specification from R6RS.