Loading [MathJax]/jax/output/HTML-CSS/config.js
  • <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>

  • DriveWorks SDK Reference
    5.8.83 Release
    For Test and Development only

    All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    Memory Management Policies and Multithreading

    The NVIDIA® DriveWorks memory management policy defines conventions intended to protect modules from memory corruption during runtime.

    Memory Management

    For modules that require memory, the preferred method is static allocation (on the stack). When that is not possible, memory allocation is controlled with these conventions:

    • During initialization/creation, modules use a memory allocator to dynamically allocate memory (on the heap). DriveWorks provides a default memory allocator; however, you can also supply your own custom memory allocator. See Using Custom Memory Allocators (below) and Core Dynamic Memory.
    • Memory allocator APIs allocate dynamic memory only during initialization time (before runtime mode begins). With this restriction, dynamic memory allocation provides similar protections to static memory allocation.

    Using Custom Memory Allocators

    Before initializing a context, you can pass an instance of a custom memory allocator to the SDK. The SDK then uses the memory allocator to perform dynamic memory allocations.

    Note
    SDK modules do perform dynamic allocations only during initialization/creation time and perform no allocations at runtime.
    // setup memory allocator
    dwDynamicMemory_initialize(myMalloc, myFree, myContext);
    // initialize SDK
    dwInitialize(&sdkContext, DW_VERSION, &contextParams);
    ...
    // do processing
    ...
    // release SDK context
    dwRelease(&sdkContext);
    // release memory allocator
    NVIDIA DriveWorks API: Core Dynamic Memory
    #define DW_VERSION
    DW_API_PUBLIC dwStatus dwInitialize(dwContextHandle_t *const context, dwVersion const headerVersion, dwContextParameters const *const params)
    Creates and initializes an SDK context.
    DW_API_PUBLIC dwStatus dwRelease(dwContextHandle_t const context)
    Releases the context.
    DWALLOC_API_PUBLIC void dwDynamicMemory_release()
    Release dwDynamicMemory.
    DWALLOC_API_PUBLIC void dwDynamicMemory_initialize(dwDynamicMemoryMallocCallback mallocCallback, dwDynamicMemoryFreeCallback freeCallback, void *const userData)
    Initialize dwDynamicMemory with user-defined callback for user space memory allocations.
    Note
    As of this release, the user allocator is global. As such, it is not bound to a specific SDK context.

    Thread Safety

    Currently, the methods that DriveWorks modules expose do not follow any thread- safety paradigm. To avoid the overhead of memory locks, DriveWorks methods are considered to be non-thread safe. The exceptions are methods with documentation that explicitly indicate a thread-safe implementation.

    Applications are responsible for implementing thread-safety, if such is required.

    人人超碰97caoporen国产