-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

While you're at it, it doesn't appear that Clam threads make use of shared memory although I would imagine they could and should...

- --
Patrick Walsh
eSoft Incorporated
303.444.1600 x3350
http://www.esoft.com/


On Jun 1, 2006, at 10:19 AM, Peter Vollmer wrote:

Hi,

I'm currently trying to understand the memory allocation implementation in clamav because we want to try to address the increasing memory requirements
in our clamav port to an embedded device.

Obviously working on memory allocation would have a serious impact on
all components of clamav, so I would really appreciate comments from the
clamav developers to get a better understanding what could/should be
done.

First I would like to do some research to get a picture of memory consumption by the different parts of clamav. Then I would like to see if there are possibilities to optimize memory allocation. I had the following ideas so far :

* manage different heaps using its own page management for some selected purposes in the scan engine, to reduce fragmentation after one task has been completed and allocated memory has been freed. One such part could be the allocations
  done for file blobs.

* introduce some kind of slab allocator (similar to the linux kernel) for the database root structure to reduce the burden of allocating very small chunks
  and the fragmentation problems on database reload

* use a unified memory allocation interface if possible

AFAICS there are 3 different malloc methods in use now:

malloc ,calloc,realloc used directly by:
clamd/dazukoio,dazukoio_compat12
libclamav/unrar
shared/getopt
sigtool/vba

cli_malloc, cli_realloc, cli_calloc used by:
libclamav internals in general
clamav-milter

mmalloc, mrealloc, mcalloc used by:
clamd
clamdscan
freshclam
shared/cfgparser
sigtool

As a first step, wouldn't it make sense to use a unified interface for
malloc ? Any experimental malloc replacements could then be hooked in there.

Best Regards
Peter


--
Peter Vollmer
Software Engineer

Innominate Security Technologies AG  /device attached security/
Albert-Einstein-Str. 14
D-12489 Berlin, Germany
www.innominate.com

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

-----BEGIN PGP SIGNATURE-----

iD8DBQFEfx5bAhJNUdTnc2gRApqlAKDbqVd2jFC0vk4WYV3k8R5g5J2BoACg0rij
gn/Rw9dH3qdh+yhLHHmnkIA=
=X+a2
-----END PGP SIGNATURE-----
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to