[gdal-dev] vsimem files
Even Rouault
even.rouault at spatialys.com
Mon Nov 23 12:08:13 PST 2020
Hi,
> I am adding support for working with *vsimem* files from JS buffers to
> *node-gdal-next *and I have a couple of questions.
>
> * There is an example for working with *vsimem* files at
> https://gdal.org/api/cpl.html#_CPPv424VSIInstallMemFileHandlerv - it
> says that a *VSIFile* handle is to be immediately closed with
> *VSIFClose* after obtaining it. For me it I get a segfault if I do
> this, but works perfectly if I do not.
You should investigate that further. If you don't VSIFCloseL (note the L
suffix) the file, you'll get a file handle leak
> * It seems that I am supposed to call *VSIInstallMemFileHandler*
> before using vsimem files, but they seem to work anyway. So, my
> question is do I need to call it and is there any downside to
> calling it if I am not using vsimem files (ie can I call it all the
> time)?
VSIInstallMemFileHandler() is called automatically the first time you access a
file. No need to explicitly call it.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list