I created a perl socket server using use Danga::Socket::AnyEvent and Danga::Socket::Callback which basically used AnyEvent::HTTP
Anyways the problem is that there is a slow memory leak ,and when using Devel::Gladiator arena_table() function I see:
ARENA COUNTS:
475641 REF
333577 SCALAR
105335 REF-CODE
103141 HASH
101462 REF-HASH
99024 ARRAY
82090 REF-Tie::RefHash::Nestable
74231 REF-ARRAY
69084 REF-Tie::RefHash::Weak
49129 Tie::RefHash::Nestable
39068 REF-Danga::Socket::GCallback
17199 Danga::Socket::GCallback
4827 GLOB
4155 CODE
2062 REF-AnyEvent::Loop::io
1201 REF-SCALAR
1048 IO::File
1032 REF-IO::Socket::INET
1031 AnyEvent::Loop::io
1031 IO::Socket::INET
576 REGEXP
58 Regexp
57 REF-Regexp
7 VSTRING
6 Tie::RefHash::Weak
4 Encode::XS
4 REF-Encode::XS
3 REF-Encode::utf8
2 Encode::utf8
2 FORMAT
2 REF-Config
2 REF-version
2 pseudohash
2 version
1 AnyEvent::CondVar
1 Config
1 Encode::Internal
1 Errno
1 LVALUE
1 POSIX::SigRt
1 Protocol::WebSocket::Frame
1 Protocol::WebSocket::Handshake::Server
1 Protocol::WebSocket::Request
1 Protocol::WebSocket::Response
1 REF-AnyEvent::CondVar
1 REF-Encode::Internal
1 REF-Errno
1 REF-POSIX::SigRt
1 REF-Protocol::WebSocket::Frame
1 REF-Protocol::WebSocket::Handshake::Server
1 REF-Protocol::WebSocket::Request
1 REF-Protocol::WebSocket::Response
The first main problem I think is that REF-Tie::RefHash::Nestable, Tie::RefHash::Nestable seem way too high.
The only use of them is
tie %clients, 'Tie::RefHash::Weak';
tie %users, 'Tie::RefHash::Weak';
tie %connectionCheck, 'Tie::RefHash::Weak';
tie %connectionType, 'Tie::RefHash::Weak';
tie %hs, 'Tie::RefHash::Weak';
tie %frame, 'Tie::RefHash::Weak';
tie %rooms, 'Tie::RefHash::Nestable';
But, when counting/logging them using the following code:
print FILE '%clients: ' . scalar(keys %clients) . ' ' . total_size
+(\%clients) . "\n";
print FILE '%users: ' . scalar(keys %users) . ' ' . total_size(\%u
+sers) . "\n";
print FILE '%connectionCheck: ' . scalar(keys %connectionCheck) .
+' ' . total_size(\%connectionCheck) . "\n";
print FILE '%connectionType: ' . scalar(keys %connectionType) . '
+' . total_size(\%connectionType) . "\n";
print FILE '%hs: ' . scalar(keys %hs) . ' ' . total_size(\%hs) . "
+\n";
print FILE '%frame: ' . scalar(keys %frame) . ' ' . total_size(\%f
+rame) . "\n";
print FILE '%rooms: ' . scalar(keys %rooms) . ' ' . total_size(\%r
+ooms) . "\n";
The output is low such as:
%clients: 1035 2919225
%users: 1038 2919225
%connectionCheck: 767 2919225
%connectionType: 1035 2919225
%hs: 1 2919225
%frame: 1 2919225
%rooms: 213 3292324
All of the references are to RefHash objects are to Danga::Socket::Callback and are deleted by using code such as delete($users{$client}) when the client disconnects. It seems impossible that the scalar(keys %hashes) numbers could add up to the large 69084 REF-Tie::RefHash::Weak number shown on arena counts. Am I missing something? Thanks