logo separator

[mkgmap-dev] [PATCH v1] Reduce memory footprint of tags

From Steve Ratcliffe steve at parabola.me.uk on Mon Feb 8 20:59:29 GMT 2010

Hi

> method. This ensures that the String "highway" exists only once when
> stored as tag. Additionally the values of the most common tags with a
> limited number of different values are also interned. (It makes sense to
> intern the value of a highway tag but it does not make sense to intern
> the value of a name tag because the share rate of the name tag values is
> too low).
>
> This all might sound embarrasing but the String objects that are
> returned from the XML reader are not interned. You can test this easily
> by exchanging the put method in class tag:

> I have seen memory reductions of > 10%.

This is all very true.

In fact the patch on the style-speed branch sneakily does an equivalent 
thing to itern'ing the key values, which does indeed save a lot of
memory.  So we do not need to add intern() inside Tags.put

The intern on the values has less effect but might be still worth doing.

..Steve




More information about the mkgmap-dev mailing list