<p>Osm2pgsql uses virtual memory fairly wasteful and kind of assumes that you have 64 bit address space and an efficient memory management. So there are a number of places, where it just allocates something like 2GB of memory  with a good chance of never writing to that memory and thus never needing that amount of physical memory. However, depending on your over commit settings of your OS and how well your OS handles those situations, this might not work well.</p>

<p>As the error message sais, you should try the parameter "--cache-strategy sparse" which is less wastefull of virtual memory and thus might work (It roughly limits itself to what is specified in the -C parameter).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/openstreetmap/osm2pgsql/issues/17#issuecomment-16612541'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/g8smGCFOcVLF28Q-xX3zcW-d33n4r8WrCNydIU1a3QHb59J4XCGJD3Vp-vhb4A2K.gif' height='1' width='1'></p>