[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] CommConnect features & memory leak




#! /usr/bin/perl -w
I am using CommConnect.pl to slurp data in from a serial port and have a 
question and a problem.

Q: Is is possible to increase the size of the data buffer and how?

P: It appears that CommConnect has a memory leak. I have abstracted the 
following snippet to demonstrate the leak. On a Quadra 950 running MacOS 
7.5.5, MacPerl 5.1.0r4, CommConnect v1.1, and with data into the serial 
port of 30 bytes once per second the snippet leaks (very roughly) 300 
bytes/sec.

 #! /perl -w
	use strict;
	use Mac::Events qw(WaitNextEvent);
	require "CommConnect.pl";

	CommConnect'Prepare("Serial Tool");
	CommConnect'ChangeSettings('Baud 9600 DataBits 8 Parity None StopBits 1 
Port "Printer Port" Handshake None HoldConnection False RemindDisconnect 
False');
	CommConnect'OpenConnection();
	
	my $buffer = '';
	while (1) {
		WaitNextEvent(1);
		CommConnect'Idle();
		$buffer = CommConnect'Receive();
	}
	
	exit;

	sub END {
		if (defined $buffer) {
			CommConnect'CloseConnection();
			CommConnect'Cleanup();
		}
	}


--
Joseph A. DiVerdi, Ph.D.                      970.221.3982 (voice)    
diverdi@XTRsystems.com (email)                970.224.3723 (fax)
http://www.XTRsystems.com
%PGPKey=('D50A9E33',[1024,'D790 3F87 2944 1E65 3286 1AD4 1A10 C5E1 D50A 
9E33'])


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org