Advice on hash sizes please

Advice on hash sizes please

am 04.03.2008 23:40:01 von Barry Brevik

I am now writing some database extraction utilities at the company I
work for, using Perl on Windows 2000/XP. There are several static tables
I download via ODBC that I perform lookups into... An ideal application
for a hash.

After the 5th table, I started to worry about how much memory this was
using, so I checked the combined size of these hashes, and it came to
about 64KB. This is without factoring-in the hash overhead. The app runs
well right now, but I'm concerned about breakage going forward.

Since this is used in-house, I can guarantee that the app will always
run on a machine with at least 2 GB of RAM and a 4 GB swap file. The
user might also be running a couple of Office apps, but that would be
all.

Granted that the answer to this question includes *many* variables I
have not addressed, is there still some sort of guideline I can use to
determine how much memory tied up in hashes is "too much"? Also, if I
reinitialize an existing hash to (), will that return the memory to
Windows?

Barry Brevik
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Advice on hash sizes please

am 05.03.2008 12:21:45 von Brian Raven

Barry Brevik <> wrote:
> I am now writing some database extraction utilities at the company I
> work for, using Perl on Windows 2000/XP. There are several static
> tables I download via ODBC that I perform lookups into... An ideal
> application for a hash. =

> =

> After the 5th table, I started to worry about how much memory this
> was using, so I checked the combined size of these hashes, and it
> came to about 64KB. This is without factoring-in the hash overhead.
> The app runs well right now, but I'm concerned about breakage going
> forward. =

> =

> Since this is used in-house, I can guarantee that the app will always
> run on a machine with at least 2 GB of RAM and a 4 GB swap file. The
> user might also be running a couple of Office apps, but that would be
> all. =

> =

> Granted that the answer to this question includes *many* variables I
> have not addressed, is there still some sort of guideline I can use
> to determine how much memory tied up in hashes is "too much"?

If you want to get a better picture of how much memory your hashes are
using, then something like Devel::Size might help, but I think you will
need considerably more than 64kb to give you any problems.

Of course if you are worried about the size of your hashes, it is
generally recommended to store them on disk, using Tie and the DB
modules, but you pay a penalty in access times, ...

.... or alternatively store your hashes in a database!

> Also,
> if I reinitialize an existing hash to (), will that return the memory
> to Windows? =


Perl may well return some freed memory to the OS in some circumstances,
but don't rely on it.

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs