Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c7ef5416b60cdf1cb62d9800c11e892a2a680a8106b2a3db78937c9d5ffadb7e
Ticket: 5888e0e1018d10cbac197161f9b415c532f1b6f6
memory leak
User & Date: sebres on 2026-02-07 14:47:40
Changes

  1. closedate changed to: "2461079.11643613"
  2. closer changed to: "sebres"
  3. icomment:
    Yes, the analyse of Rolf is pretty correct - the (bignum) value of <code>randseed</code> grows endless by 2<sup>i</sup> with each iteration, so the bignum math becomes slower as well as the memory reserved for this "integer" grows.
    
    I suspect it's missing something like a constant constraint (truncation to wide-int or int):
    <code><pre>
     set randval 0
     for {set j 0} {$j < 12} {incr j} {
       set xnor [expr {~ (($randseed >> 31) ^ ($randseed >> 30) ^ ($randseed >> 28) ^ ($randseed >> 27))}]
    <b style="color:red">-  set randseed [expr {($randseed << 1) | ($xnor & 1)}]</b>
    <b style="color:green">+  set randseed [expr {($randseed << 1) & 0x7fffffffffffffff | ($xnor & 1)}]</b>
       set randval [expr {($randval << 1) | ($randseed & 1)}]
     }
    </pre></code>
    
    Thus it is clearly not a memleak or performance degradation, ticket is closed as incorrect.
    
  4. login: "sebres"
  5. mimetype: "text/x-fossil-wiki"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"