[GRASS5] v.in.ascii
Radim Blazek
radim.blazek at gmail.com
Mon Aug 22 05:08:42 EDT 2005
On 8/16/05, Helena Mitasova <hmitaso at unity.ncsu.edu> wrote:
> Radim Blazek wrote:
> > Please read my previous mails about that, IT IS implemented,
> > and IT DOES NOT call free() by default because it is faster
> > and IT CAN free the memory if it is necessary. I wrote that 2-3
> > times already.
>
> I meant at the module level, as a user how can I tell v.in.ascii or
> v.build or any other module that builds topology to free the memory
> when needed? From your emails it seemed to me
> that this option needs to be added to the relevant modules, but I might
> have misunderstood it,
>
> Helena
Spatial index occupies a lot of memory but it is necessary for
topology building. Also, it takes long time to release the memory
occupied by spatial index (dig_spidx_free) .
The function building topology (Vect_build) is usually called
at the end of module (before Vect_close) so it is faster to call
exit() and operating system releases all the memory much faster.
By default the memory is not released.
It is possible to call Vect_set_release_support() before Vect_close()
to force to release the memory, but it takes long time on large files.
Currently most of the modules do not release spatial index and work
like this:
main
{
Vect_open_new()
//writing new vector
Vect_build()
Vect_close() // memory is not released
}
you can add Vect_set_release_support():
main
{
Vect_open_new()
// writing new vector
Vect_build()
Vect_set_release_support()
Vect_close() // memory is released
}
but it only takes longer time.
It make sense to release spatial index if it is used only at the beginning
of a module or in permanently running programs like QGIS.
For example:
main
{
Vect_open_old()
// select features using spatial index, e.g. Vect_select_lines_by_box()
Vect_set_release_support()
Vect_close() // memory is released
// do some processing which needs memory
}
Radim
More information about the grass-dev
mailing list