Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7342) cm patch: heap-allocate the combinations
Home

[Freeciv-Dev] (PR#7342) cm patch: heap-allocate the combinations

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7342) cm patch: heap-allocate the combinations
From: "Benoit Hudson" <bh@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Jan 2004 19:08:09 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7342 >

This patch heap-allocates combinations.  This is essentially just me
breaking up the per-city-cache patch into smaller unrelated chunks.

The benefit: memory footprint drops from about 700 KB for the CM to much
much less.  In a game at year 1890 AD, I see 70 KB; all-ai to 1 AD I see
about 10 or 20 KB (plus additional stuff that I don't compute whose size
is unaffected by the patch).  Doesn't seem to have any measurable impact
on running time.  valgrind finds no leaks caused by my patch, and
everything seems to work for the cases I mentioned above.

Other changes in this: a few more comments ; 
new function free_combination that releases all its storage ;
combinations array now holds pointers to combinations, so we never
    need to loop over invalid combinations (we can just free it and
    move another combination in its place)
a function (enabled at compile time) to report the storage in cache3

        -- Benoît




[Prev in Thread] Current Thread [Next in Thread]