Hello.
Thanks for the replies.
Here is a little bit of my perl script i wrote.
The problem is: At start time it uses 10MB Memory.
And if a user writes a message ( SENDMESSAGE ) , it needs for every message ( 300 KB of memory ).
Now ... how can i fix the problem?
use feature 'state';
use Time::HiRes;
require "config.cfg";
require "Subs.pl";
require "format.pl";
require "server/mainprogram_subs.pl";
require "ConnectDB.pl";
require "loadconfig.pl";
require "$config{language}.lng";
require 5.002;
use IO::Socket::SSL 'inet4';
$IO::Socket::SSL::DEBUG = 3;
use IO::Select;
use Time::HiRes;
use HTML::Template;
use Text::Wrap;
use Fcntl ':flock';
use strict;
no strict 'refs';
later in my program:
if($buffer =~ /^SENDMESSAGE$digest\|(.*?)$/){
my $what = $1;
my($room,$touser,$kind,$message,$fromuser)=
+split /\|/, $what;
my $myuser = $fromuser;
my $update_sock = getCurrentIdent($myuser);
if( SockExists($update_sock) ) {
$clients{$update_sock}->{lastsrvpost} = ti
+me;
}
if($touser eq "" && $room ne "" && $kind ne
+"PRVMESSAGE") { sendToSocket($message, { toroom => $room, kind =>
+ $kind, fromuser => $myuser } );
}elsif($touser ne "" && $room eq "" && $kind
+ ne "PRVMESSAGE" ) { sendToSocket($message,{ fromuser => $myuser, tou
+ser => $touser, kind => $kind } );
}elsif($touser eq "" && $room eq "" && $kind
+ ne "PRVMESSAGE") { sendToSocket($message, {});
}
next;
and the sendToSocket routine is the following:
sub sendToSocket {
my( $data, $params ) = @_;
if( $data eq "" ) {
return 0;
}
if( $params->{toroom} ne "" && $params->{touser} eq "" ) {
foreach my $ident( keys %clients ) {
our $nick = $clients{$ident}->{nick};
if( isInIgnorelist($nick, $params->{fromuser}) && $co
+nfig{ignore_modus}{$params->{kind}}==1) {
}else{
my %info = loadMemberInfo($nick);
if( lc $params->{toroom} eq lc $info{room}) {
my $fh = $clients{$ident}->{sock};
if( defined $fh ){
my $msg = createFilter($ident, $data);
$fh->syswrite($msg . "\n");
undef $fh;
undef $msg;
undef %info;
undef $nick;
}
}
}
}
}elsif( $params->{toroom} eq "" && $params->{touser} ne "" ) {
my $user = $params->{touser};
my $sock = getCurrentSocket($user);
my $sn= $sock->{sockname};
my $socket = $sock->{socket};
my $ident = getCurrentIdent($user);
if( isInIgnorelist($clients{$sn}->{nick}, $params->{from
+user}) && $config{ignore_modus}{$params->{kind}}==1 ) {
}else{
if( defined $socket ){
$msg = createFilter($ident, $data);
$socket->syswrite($msg . "\n");
undef $msg;
undef $ident;
undef $sock;
}
}
}elsif( $params->{touser} eq "" && $params->{toroom} eq "" ) {
foreach my $ident( keys %clients ) {
my $sock = $clients{$ident}->{sock};
$msg = createFilter($ident, $data);
if( defined $sock ){
$sock->syswrite($msg . "\n");
}
undef $msg;
undef $sock;
}
}
}
But if i use undef, nothing happens. It still uses the memory :(
Hope you can help.
Thanks
Regards Sascha