나는 펄 메모리를 프로파일 링하는 법을 배우려하고있다.mod_perl을 실행할 때 스크립트가 왜 더 많은 메모리를 사용합니까?
필자는 매우 간단한 Perl hello-world 스크립트를 가지고 있으며, 메모리의 크기를 알고 싶습니다.
GTop 유틸리티를 사용하여 메모리를 측정합니다 (recommended in mod_perl book by Stas Beckman). GTop은 혼란스러운 결과를 제공합니다.
명령 줄에서 스크립트를 실행할 때 GTop는 7M이라고 말합니다.
mod_perl
에서 실행할 때 GTop는 54M이라고 말합니다.
왜 그렇게 많은가요?!
mod_perl
에서 스크립트 메모리가 너무 커지는 이유는 무엇입니까? 아니면 잘못된 방식으로 메모리를 측정합니까? 어떻게 perl 스크립트 메모리를 프로파일합니까? 여기
> perl simple.pl size: 7,282688 share: 2,027520 diff: 5,255168
실행 mod_perl을 아래 명령 줄에서
실행
size: 54,878208 share: 4,661248 diff: 50,216960
악보 t simple.pl
당신이 mod_perl을 아래 스크립트를 실행할 때 같아요#!/usr/bin/perl
use strict;
use warnings;
use CGI();
my $cgi = CGI->new;
print $cgi->header('text/plain');
use GTop;
print "Hello, world!\n";
my $m = GTop->new->proc_mem($$);
print "size: ".$m->size."\n";
print "share: ".$m->share."\n";
my $diff = $m->size - $m->share;
print "diff: $diff\n";