Hi team, I’m working on an AWE custom module and need guidance on proper de-initialization and memory cleanup. Are there specific destructor functions available for releasing allocated memory, buffers, and structures when the module is no longer needed? Also, is there a recommended approach to safely free memory and prevent leaks in AWE? Looking forward to your insights
Thanks,
Monika V
3:44pm
Dear DSPC , please provide an answer here, I have the same needs as Monika. For an custom module you can define an constructor, where heap allocation could take place for an module, but why is where no destructor notify function? or are where other ways to get notified about when the awe instance is being destroyed?
Thanks,
Klaus B&O
4:18pm
Hi Klaus,
While there is no specific destructor function for modules, or "free" function to match awe_fwMalloc(), you can catch mask value 0 in a custom module's "Set()" function which does indicate that the layout is being destroyed. Can you let me know a bit more about your use case so I can see if there's something more appropriate?
Thanks,
Gary
5:08am
Hi Gary, thanks for your fast reply. This actually works perfect for our CM C++ object use case. An instance get allocated in the constructor function and deleting in the set function when the mask argument value is zero. I assume this is thread safe, meaning the process function and the set function are not called parallel or running concurrently.
Cheers, Klaus and thanks for the support:-)
11:00am
Hi Klaus,
It is the case that the Set() function operates on a lower priority thread than audio I/O or processing.
A Set() function could be interrupted by audio I/O or processing, but not vice versa.
In the case where you were really "destroying" the layout, it would be good to stop audio processing first if there was any concern about this.
The first two lines of a generated AWS file do just this:
Thanks,
Gary