| Title | Example Scheme interpreter does not finalize ports |
| Status | closed |
| Priority | optional |
| Assigned user | Gareth Rees |
| Organization | Ravenbrook |
| Description | The 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. |
| Analysis | Finalization 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 found | manual_test |
| Evidence | See description. |
| Observed in | 1.110.0 |
| Created by | Gareth Rees |
| Created on | 2012-10-22 15:52:53 |
| Last modified by | Gareth Rees |
| Last modified on | 2012-10-22 15:54:20 |
| History | 2012-10-22 GDR Created. |
| 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. |