X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FSize.pm;h=61ad18380c1a6c0020ebfa24d13b33ceadedc5ac;hb=3cba7a2c0211121aabb5cda50db17a5d84de1773;hp=2355afca502fb7ec74ec1638ca83c2c0a5918e36;hpb=0d46c0bd49534388814d9797c6a5c2d52f168796;p=p5sagit%2FDevel-Size.git diff --git a/lib/Devel/Size.pm b/lib/Devel/Size.pm index 2355afc..61ad183 100644 --- a/lib/Devel/Size.pm +++ b/lib/Devel/Size.pm @@ -1,25 +1,22 @@ package Devel::Size; use strict; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $warn $dangle); +use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS $warn $dangle); -require 5.008; +require 5.005; require Exporter; -require DynaLoader; +require XSLoader; -@ISA = qw(Exporter DynaLoader); +@ISA = qw(Exporter); -# This allows declaration use Devel::Size ':all'; -%EXPORT_TAGS = ( 'all' => [ qw( - size total_size -) ] ); +@EXPORT_OK = qw(size total_size); -@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); +# This allows declaration use Devel::Size ':all'; +%EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); -@EXPORT = qw( ); -$VERSION = '0.72_50'; +$VERSION = '0.77_50'; -bootstrap Devel::Size $VERSION; +XSLoader::load( __PACKAGE__); $warn = 1; $dangle = 0; ## Set true to enable warnings about dangling pointers @@ -192,37 +189,22 @@ that consumes far less memory than was previously the case. It does this by using a bit vector where 1 bit represents each 4- or 8-byte aligned pointer (32- or 64-bit platform dependant) that could exist. Further, it segments that bit vector and only allocates each chunk when an address is seen within -that chunk. By default, the module builds a static table of 8,192 slots of -16k chunks which is sufficient to cover the full 4GB virtual address space on -32-bit platforms. Or the first 8GB on 64-bit platforms. +that chunk. Since version 0.73, chunks are allocated in blocks of 2**16 bits +(ie 8K), accessed via a 256-way tree. The tree is 2 levels deep on a 32 bit +system, 6 levels deep on a 64 bit system. This avoids having make any +assumptions about address layout on 64 bit systems or trade offs about sizes +to allocate. It assumes that the addresses of allocated pointers are reasonably +contiguous, so that relevant parts of the tree stay in the CPU cache. Besides saving a lot of memory, this change means that Devel::Size runs significantly faster than previous versions. -One caveat of this new mechanism is that on 64-bit platforms with more than 8GB -of memory a new fatal error may be seen. See the next section. - =head1 Messages: texts originating from this module. =head2 Errors =over 4 -=item "Devel::Size: Please rebuild D::S with TRACKING_SLOTS > 8192" - -This fatal error may be produced when using Devel::Size on 64-bit platforms -with more than 8GB of virtual memory. It indicates that a pointer has been -encountered that is to high for the internal pointer tracking mechanism. - -The solution is to rebuild Devel::Size having edited Size.XS to increase -the value of - - #define TRACKING_SLOTS 8192 - -On 64-bit platforms, Devel::Size requires 1 slot for each 1MB of virtual -address space. So, for a system with 12GB of memory, this should be set to -12GB / 1MB = 12884901888 / 1048576 = 12288 ( 12 * 1024 ). - =item "Devel::Size: Unknown variable type" The thing (or something contained within it) that you gave to @@ -255,9 +237,10 @@ These may be disabled by setting Devel::Size has always been vulnerable to trapping when traversing Perl's internal data structures, if it encounters uninitialised (dangling) pointers. -Exception handling has been added to deal with this possibility, and Devel::Size -will now attempt to ignore (or log) them and continue. These messages are mainly -of interest to Devel::Size and core developers, and so are disabled by default. +MSVC provides exception handling able to deal with this possibility, and when +built with MSVC Devel::Size will now attempt to ignore (or log) them and +continue. These messages are mainly of interest to Devel::Size and core +developers, and so are disabled by default. They may be enabled by setting @@ -290,9 +273,11 @@ Dan Sugalski dan@sidhe.org Small portion taken from the B module as shipped with perl 5.6.2. -New pointer tracking & exception handling by BrowserUK +Previously maintained by Tels + +New pointer tracking & exception handling for 0.72 by BrowserUK -Maintained now by Tels +Currently maintained by Nicholas Clark =head1 COPYRIGHT