Skip to content
Tcl Source Code History Of Ticket 582256
Login

History Of Ticket 582256

Artifacts Associated With Ticket 582256

  1. Ticket change [96c0edcfbb] (rid 106378) by dkf on 2002-07-16 14:24:14:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      This patch implements an optional (i.e. selectable
      through an argument to configure) new object allocator
      for the Tcl core that has the following properties:
      
        * it allocates objects in blocks (similar to the
          standard Tcl_Obj allocator)
        * it detects when a block is surplus to requirements
          (new feature)
        * it returns the block to the OS when that happens
          (new feature)
      
      The downside to this is that it makes the core slower
      due to the extra time required to manage a more complex
      free-list system, and the fact that if a block is
      discarded and more objects subsequently become
      necessary then a system call is required to get more
      memory (though that is of course the whole point.)
      
      At time of submission, this code is only verified to
      work under Solaris 8.
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dkf"
    9. subsystem initialized to: "41. Memory Allocation"
    10. title initialized to: "Releasing Tcl_Obj Allocator"
    11. type initialized to: "Patch"
  2. Ticket change [16769fdae7] (rid 124723) by dkf on 2002-07-16 21:43:59:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      D'oh!  Try again...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  3. Ticket change [e8eec86377] (rid 104727) by dkf on 2002-07-16 21:44:00:

    1. icomment:
      
      
      File Added - 27126: objalloc2.patch
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  4. Ticket change [cb437917f5] (rid 95486) by dkf on 2002-07-17 20:43:22:

    1. icomment:
      
      
      File Deleted - 27126: 
      
      
      
      File Added - 27230: objalloc2.patch
      
      Logged In: YES 
      user_id=79902
      
      Experience shows that the allocator that this provides
      significantly speeds up tclbench on Solaris8, with slightly
      better overall gains when the page-size (modified through
      changing the Makefile) is 32kB than when it is the default
      (8kB).  This is not something I really anticipated!
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [a4b73b9dc6] (rid 110251) by dkf on 2002-07-19 21:49:01:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Minor fix of stupid fault...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Add attachment "objalloc2.patch" [c6685f33f8] (rid 121761) by dkf on 2002-07-19 21:49:01.

  7. Ticket change [4d691fc2f0] (rid 127047) by dkf on 2002-07-19 21:49:02:

    1. icomment:
      
      
      File Deleted - 27230: 
      
      
      
      File Added - 27387: objalloc2.patch
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  8. Ticket change [b0c8d4d53e] (rid 98039) by nwourms on 2005-02-04 06:07:10:

    1. icomment:
      Logged In: YES 
      user_id=556358
      
      Can your please resync with HEAD?
      
      
    2. login: "nwourms"
    3. mimetype: "text/plain"
    4. username: "nwourms"
  9. Ticket change [d363114314] (rid 123281) by georgeps on 2006-01-07 15:14:50:

    1. icomment:
      Logged In: YES 
      user_id=585068
      
      This patch will break on some platforms.  It assumes that a
      long can store a pointer value, which is usually true, but
      isn't required.  IIRC Win64 just has 64-bit pointers, and
      keeps long as a 32-bit type.  I also note that you're just
      supporting mmap.  VirtualAlloc can be used in Windows to
      accomplish the same thing.
      
      Specifically this code:
        PoolBookkeeping *pagePtr = (PoolBookkeeping *)
            (((long)objPtr) & POOL_ADDR_MASK);
      
      This code clearly seems wrong: 
      if (devzero == -123456) {
      +       /*
      +        * This leaks a file-descriptor, but there's no neat
      way to
      +        * avoid it without opening and closing each time,
      which is
      +        * desperately inefficient.
      +        */
      +       devzero = TclOSOpen("/dev/zero", O_RDONLY);
      +    }
      +    if (devzero<0) {
      +       return NULL;
      +    }
      
      How much of an impact is it to close and reopen /dev/zero? 
      Have you compared the cost to a memset (gcc builtin)?  
      
      This code scares me a bit:
      +#   ifndef MAP_FAILED
      +#       define MAP_FAILED      ((VOID *)-1)
      +#   endif
      
      What platforms lack MAP_FAILED?  Can we safely assume that
      -1 is the right value on such a platform?
      
      
      
    2. login: "georgeps"
    3. mimetype: "text/plain"
    4. username: "georgeps"
  10. Ticket change [517c721695] (rid 126147) by dkf on 2006-01-07 16:15:08:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      This code pre-dates Win64 :-) so adapting it to use suitable
      integer types is perfectly OK with me. The main thing is
      that there needs to be a way to mask off the lower bits to
      get the address of the start of the page containing the
      Tcl_Obj so that the book-keeping structure can be located.
      
      The cost of closing and reopening any file descriptor has
      got to be appreciable because it requires two context
      switches (plus string parsing to convert the filename into a
      directory entry, etc.) Some Unix platforms instead do page
      allocation through mmap()ing a specific invalid handle. Note
      that the cost of the memset is almost beside the point (it's
      the update to the page table we really want!) and there's no
      guarantee that that's what a map of /dev/zero would be
      doing; taking advantage of the bus width to write more at
      once would be practical in an OS kernel.
      
      In any case, as I wrote, this code is only known to work on
      Solaris 8, which is pretty old nowadays. If you want to
      update it to work with newer systems (and a newer Tcl too,
      including the threaded Tcl_Obj allocator) then be my guest.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [d4083c50b0] (rid 123378) by georgeps on 2006-01-09 14:19:46:

    1. icomment:
      Logged In: YES 
      user_id=585068
      
      I'm interested in some kind of better Tcl_Obj pool that
      doesn't use a high-water-mark allocator, because I think it
      could help performance (as you found).  I have profiled Tcl
      using a modified tcl-bench and gprof in NetBSD x86, and
      malloc consumes a great deal. 
      
      The cost of using malloc is probably greater, because it's
      designed for a wide range of objects.  The problem of
      fragmentation also occurs with malloc and a mixture of
      Tcl_Obj and other structures, that generally doesn't occur
      with a specialized pool allocator (although it could
      influence page release).
      
      I am interested in working on a new pooled allocator patch.
         I have implemented object pools in another project (not
      thread-safe though), so I think I have enough experience to
      give it a try, and make sense of your changes.  I'm also
      going to study "Zippy" (the threaded allocator to see what I
      can learn).  :)
      
      
      
    2. login: "georgeps"
    3. mimetype: "text/plain"
    4. username: "georgeps"
  12. Ticket change [c7c19704da] (rid 148394) by dkf on 2016-08-20 16:46:23:

    1. assignee changed to: "aku"
    2. closer changed to: "nobody"
    3. comment changed to:
      This patch implements an optional (i.e. selectable
      through an argument to configure) new object allocator
      for the Tcl core that has the following properties:
      
        * it allocates objects in blocks (similar to the
          standard Tcl_Obj allocator)
        * it detects when a block is surplus to requirements
          (new feature)
        * it returns the block to the OS when that happens
          (new feature)
      
      The downside to this is that it makes the core slower
      due to the extra time required to manage a more complex
      free-list system, and the fact that if a block is
      discarded and more objects subsequently become
      necessary then a system call is required to get more
      memory (though that is of course the whole point.)
      
      At time of submission, this code is only verified to
      work under Solaris 8.
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. priority changed to: "3 Low"
    7. severity changed to: "Minor"