aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-06-09 19:58:12 +0200
committerGitHub <noreply@github.com>2021-06-09 19:58:12 +0200
commit5436e8aa46f7fb6dd6c9853e5da7222d8e6607e1 (patch)
tree55a7ac8146c327d54a9423db8a66a8dbbf54709c /src/malloc.cpp
parentfae861c75adbc598393245f34ad8871a9aaecd44 (diff)
parent61e25ec859a34e68fa8c2dc99f951f3e970875df (diff)
downloadPROJ-5436e8aa46f7fb6dd6c9853e5da7222d8e6607e1.tar.gz
PROJ-5436e8aa46f7fb6dd6c9853e5da7222d8e6607e1.zip
Merge pull request #2738 from rouault/share_sqlite_handle
Share SQLite database handle among all contexts
Diffstat (limited to 'src/malloc.cpp')
-rw-r--r--src/malloc.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/malloc.cpp b/src/malloc.cpp
index 6b7fbf26..d60a3f92 100644
--- a/src/malloc.cpp
+++ b/src/malloc.cpp
@@ -33,6 +33,9 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
+#ifndef FROM_PROJ_CPP
+#define FROM_PROJ_CPP
+#endif
/* allocate and deallocate memory */
/* These routines are used so that applications can readily replace
@@ -46,6 +49,8 @@
#include <new>
+#include "proj/internal/io_internal.hpp"
+
#include "proj.h"
#include "proj_internal.h"
#include "grids.hpp"
@@ -176,8 +181,16 @@ PJ *pj_default_destructor (PJ *P, int errlev) { /* Destructor */
/*****************************************************************************/
void proj_cleanup() {
/*****************************************************************************/
+
+ // Close the database context of the default PJ_CONTEXT
+ auto cpp_context = pj_get_default_ctx()->cpp_context;
+ if( cpp_context ) {
+ cpp_context->closeDb();
+ }
+
pj_clear_initcache();
FileManager::clearMemoryCache();
pj_clear_hgridshift_knowngrids_cache();
pj_clear_vgridshift_knowngrids_cache();
+ pj_clear_sqlite_cache();
}