postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: apgrucza (@apgrucza) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] PR #6: Use mimalloc to improve performance and reduce memory allocation lock contention
Date: Wed, 06 Mar 2024 00:37:41 +0000
Message-ID: <[email protected]> (raw)

We have a multi-threaded Windows application that was experiencing delays due to high lock contention in memory allocations from the PostgreSQL ODBC driver. We tried modifying the driver to use [mimalloc](https://github.com/microsoft/mimalloc), which is a memory allocator with better performance characteristics. After deploying this change, the delays due to lock contention disappeared. It has been running on thousands of our production deployments for 9 months without issue.

I've created this pull request so that others can benefit from this change by building the driver with the `_MIMALLOC_` symbol defined and linking to the mimalloc library. If building on Windows, `BuildAll.ps1` accepts a `-UseMimalloc` argument that does this for you (requires a toolset of `v141`, `v142` or later). Below is an example of how to build with mimalloc on Windows:

```
.\BuildAll.ps1 -Platform x64 -Toolset v141 -UseMimalloc
```

Currently the usage of mimalloc is off by default, but I'd like to get people's thoughts on whether it should be enabled by default.


view thread (57+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://postgresql-interfaces/psqlodbc
  Cc: [email protected], [email protected]
  Subject: Re: [postgresql-interfaces/psqlodbc] PR #6: Use mimalloc to improve performance and reduce memory allocation lock contention
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox