Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4c30ede62f921cb1664d6cfaa26ce5cfc86d545e
Ticket: 218466ffffffffffffffffffffffffffffffffff
realloc bug -- somehow related to regsub?
User & Date: nobody on 2000-10-26 01:00:48
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 627 Bug
    Version: 8.1a2
    SubmitDate: '1998-05-25'
    LastModified: '1999-08-13'
    Severity: MED
    Status: Released
    Submitter: hershey
    ChangedBy: hobbs
    OS: All
    OSVersion: NA
    Machine: NA
    FixedDate: '1999-08-13'
    FixedInVersion: 8.2b3
    ClosedDate: '2000-10-25'
    
    
    I too have encountered this problem.  I have a 2,500 tcl/tk prog
    which gets an exception with the new regsub.  If I remove the
    call it works (I'm actually running it in production with version 8.0).
    I posted a similar warning to the above a couple of months ago
    to c.l.t.
    
    Just thought I'd let you know I think the problem is real.  When I
    have the time I'll try and get a simple example.  I did try to
    at first but failed.
    
    PS I think the new regexp stuff should have been made a "package".
    --------
    Tcl 8.1a2 is blowing up with the message "unable to realloc xxx bytes"
    when I run my program.  My code basically reads HTML files and parses them.
    It reads the entire file into a variable, then parses the data from that.
    The problem ocurrs for large files, e.g. a file "myfile" that is
    971 lines, 15383 characters gives the error.  Small files work fine.
    
    Below is the smallest code fragment that reproduces the problem
    (you need to supply an input file "mtfile" of sufficient size).
    I'm using "wish81", not tclsh81.  "wish80" from the 8.0 Tcl release works fine.
    
    Hopefully someone will use this to verify that the next release corrects
    the problem.  In the meantime, does anyone know whether there is currently
    a patch that will fix this?
    
    Thanks ...
    
    -- [email protected]
    
    # START OF TCL CODE
    proc getdata {file} {
            set fd [open $file]
            set rs [read $fd]
            close $fd
            return $rs
    }
    
    proc parse {html {cmd xtk_HMtest_parse} {start hmstart}} {
            regsub -all \{ $html {\&ob;} html
            regsub -all \} $html {\&cb;} html
            set w " \t\r\n" ;# white space
            proc xtk_HMcl x {return "\[$x\]"}
            set exp <(/?)([xtk_HMcl ^$w>]+)[xtk_HMcl $w]*([xtk_HMcl ^>]*)>
            set sub "\}\n$cmd {\\2} {\\1} {\\3} \{"
            regsub -all $exp $html $sub html
            eval "$cmd {$start} {} {} \{ $html \}"
            eval "$cmd {$start} / {} {}"
    }
    
    proc xtk_HMtest_parse {command tag slash text_after_tag} {
        puts -nonewline "."
        #puts "==> $command $tag $slash $text_after_tag"
    }
    
    proc doit {file} {
            set data [getdata $file]
            puts "size=[string length $data]"
            parse "$data"
    }
    
    doit myfile
    
    ----------
    
    More info:
    First, I forgot to mention that I'm running Tcl 8.1a2 on Window NT 4.0.
    Second, I've discovered that this program only fails when the input file
    contains particular data.  In other words, you can't reproduce the problem
    with any aritrary large file ... my file contains HTML, and some of the
    "regsub" commands process it.  So the "regsub" command must be involved in
    the problem somehow.
    If someone wants it, I'll gladly provide my data file which is needed to
    reproduce the problem (but is anyone really fixing bugs now?)
    
    -- [email protected]
    
    Some worst case regexp bugs were fixed in the 8.2b3 release. 
    -- 08/13/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.1a2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "realloc bug -- somehow related to regsub?"
  11. type changed to: "Bug"