SourceForge Logo

Memchan Logo

Tcl Logo


Memchan SF Project

© Disclaimer
Event generation



Memory channels 2.1 -- memchan(n)


memchan - Create and manipulate memory channels


package require Tcl
package require memchan

memchan ?-initial-size len?


This manpage documents both the overall package and the command memchan. The package itself provides a number of in-memory channels which can utilized to
  • capture stream-like information in a natural way instead of using set and append to manipulate strings
  • or to transfer data between interpreters, in the same thread or not.


memchan ?-initial-size len?
creates a chunk-oriented in-memory channel and returns its handle. If an initial size is specified the system will pre-allocate len bytes of buffer space for the contents. This is no restriction on the ultimate size of the channel, it will always grow as much as is necessary to accomodate the data written into it.
The channels created here can be transfered between interpreters in the same thread and between threads, but only as a whole. It is not possible to use them to create a bi- or unidirectional connection between two interpreters.

Memory channels created by memchan provide two read-only options which can be queried via the standard fconfigure command. These are

The value of this option is the number of bytes currently stored in the queried memory channel.
The value of this option is the number of bytes currently allocated by the queried memory channel. This number is at least as big as the value of -length.

As the channels generated by memchan grow as necessary they are always writable. This means that a writable fileevent-handler will fire continuously.

The channels are also readable if they contain more than zero bytes and the seek location is not and the end of the channel. Under these conditions a readable fileevent-handler will fire continuously.

Note that writing to such a channel usually occurs at the end, thus supressing readable events. This also means that users have to take care to seek the channel to a location before the end before trying to read data back.


fifo, fifo2, null


memchan, chunk, in-memory channel, channel, i/o

Last updated @ Mon Jan 20 14:15:59 PST 2003
Manpages now available   andreas_kupries - 2001-09-06 23:27
Memchan CVS   andreas_kupries - 2001-08-28 08:58
Tracker Tracker

 - Bugs ( 2 open / 5 total )
Bug Tracking System

 - Support Requests ( 1 open / 1 total )
Tech Support Tracking System

 - Patches ( 0 open / 2 total )
Patch Tracking System

 - Feature Requests ( 7 open / 8 total )
Feature Request Tracking System

Docs Doc Manager
Mail Lists Mailing Lists ( 2 mailing lists )
Tasks Task Manager
  - Documentation
  - Website
  - Memchan Dev
CVS CVS Tree ( 168 commits, 68 adds )
FTP Released Files

Andreas Kupries
Last update at Mon Jan 20 14:21:52 PST 2003