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

[MacPerl] CommConnect features & memory leak 2



Gentle List Members,

Sorry for the previous post; I slipped on the send key.

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? I 
haven't found any function in the docs that permit this control

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.

Commenting out both the 'Idle and 'Receive lines eliminates the leak.

Has anyone else seen a problem like this or have any thoughts concerning 
memory leaks associated with XCMD/XFCN calls?

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

 # set up the tool, port, and connection
	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);         # spare a moment for the OS
		CommConnect'Idle();
		$buffer = CommConnect'Receive();
	}
	
	exit;

 # ensure that everything is cleaned up when command-. is hit
	sub END {
		if (defined $buffer) {
			CommConnect'CloseConnection();
			CommConnect'Cleanup();
		}
	}

Thanks for any help!
Joseph



--
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