-----BEGIN PGP SIGNED MESSAGE-----

Moin,

On 05-Oct-02 Slaven Rezic carved into stone:
> Tels <[EMAIL PROTECTED]> writes:
>> But shouldn't that be just the same, or slightly more (if the memory is
>> used in chunks of, let's say 16 bytes, it might alloc up to 15 more).? 
> 
> The malloc system will probably get larger chunks from the underlying
> virtual memory system (4K or 8K or so). Malloc itself will use smaller
> chunks (e.g. FreeBSD and glibc malloc use 16 bytes, I think perl's
> mymalloc uses even smaller chunks).
> 
> That's fine, but memory gets fragmented. Suppose you make a large
> 1000000 byte malloc, then a 1 byte malloc, and finally free the large
> malloc'ed area. The process' memory usage will still be the same,
> because the malloc system can't give the large area back to the
> virtual memory system. This is only possible if the freed area is at
> the end of the heap.

Yes, but this are implementation specific details, and from the Perl code
you can't do anything about this. What you *can* do, though, is to look how
large single elements (an SV, an AV etc) are, and then:

* use something else in Perl
* or try to fix Perl to use less memory.

You are still at the mercy of the underlying malloc(), but that *should*
take care of all the fragmentation/sizee/chunked issues for you. :)

Cheers,

Tels

- -- 
 perl -MDev::Bollocks -le'print Dev::Bollocks->rand()'
 adaptively transition total infrastructures

 http://bloodgate.com/perl       My current Perl projects
 PGP key available on http://bloodgate.com/tels.asc or via email

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.

iQEVAwUBPZ9qRXcLPEOTuEwVAQHJ9Af9FUOt9DHcrefS/V55MdoRS50KDjWoe8wu
JD5UfmmVHAAoRWp5Y881SoDRY3eoHnIzDfX29xDHz3bIjyeUMJT5rSFYh8gXO8La
ljYl64pzYHC0Ebf53FOgHl6DHg3JsB3ljv7QD964t0a61gC5u2w1mhY4mYiuQljH
DCM7zyqWZp/PqVWhVvqeURw/8PkdBQC7LCjDSaGVU+T5DjYeZdfdW6tOlD9B8fV/
m4jhWU23ICbneNw+yaqpYMMEbUrNvroBDB0ko/TxF+bAs0XouCta0LhT7SG1/GCA
9sqLbsOtz4ZqR2STZfynLJ0LtdLIJEtCpYkxUXyolsJodWNzx+pE/Q==
=QNta
-----END PGP SIGNATURE-----

Reply via email to