Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Other memory considerations

  • I/O generally overwhelms code execution in terms of time taken. Rather than changing code to try to make it execute faster, reducing the frequency or quantity of I/O performed may provide better results.
  • Align data to best fit the bus access structure whenever practical. Many interfaces handle unaligned data at the cost of a very expense data copy behind the interface. In general, writes to memory that are 16-byte aligned are the most efficient.
  • Minimize data handling as follows:
    • Pass pointers and apply data synchronization methods rather than copying data.
    • Use Direct Memory Access (DMA) engines where available for non-trivial data transfers.
  • All Brew MP APIs should be released through IQI_RELEASEIF(). IQI_RELEASEIF will ensure that only memory of a non-null API pointer is released and after the release, the pointer will be set to NULL. This will avoid crashes from API pointers being accidently used after they have been released.
  • All memory allocated through MALLOC() or related APIs should be released with FREEIF() rather than FREE(). FREEIF() will ensure that only memory of a non-null pointer is freed and after the free, the pointer will be set to NULL. This will avoid potential double-frees in the code.