-
Notifications
You must be signed in to change notification settings - Fork 190
Developer Guidelines
TODO
TileDB has an external API to enable heap memory profiling. The heap profiler relies on developers to use an internal API instead of the standard C/C++ dynamic memory APIs. For example: developers must use tdb_malloc
instead of malloc
. A pre-checkin script performs static analysis to detect violations (in other words: expect a pre-checkin check to fail if you use malloc
in your pull request).
Currently, all APIs are defined in tiledb/common/heap_memory.h
and the violation detection script is located in scripts/find_heap_api_violations.py
.
These APIs apply only to the tiledb/
directory, excluding tiledb/sm/c_api
and tiledb/sm/cpp_api
.
Each C++ API has a complementary preprocessor macro that tags the usage of the API with the file name and line number from where it is called. Prefer the preprocessor macro to the C++ API unless you need a custom label. These macro interfaces are:
#define tdb_malloc(size)
#define tdb_calloc(num, size)
#define tdb_realloc(p, size)
#define tdb_free(p)
#define tdb_new(T, ...)
#define tdb_delete(p)
#define tdb_new_array(T, size)
#define tdb_delete_array(p)
#define tdb_shared_ptr
#define tdb_unique_ptr
#define tdb_make_shared(T, ...)