Memory monitoring of Open AT application


How can I monitor the memory usage of an Open AT application? I’ve found the Memory Module in the Target Monitoring Tool, but I don’t have any pools displayed like the ones shown in the TMT help. The Memory Parameter window tells me “Pool data has not been initialized” whenever I try to change anything. How do I set up memory pools, and how can I watch my memory usage? Are there any other ways to do it?


You can hack adl_memGet() and adl_memRelease() so that they count bytes. Something like (untested code):

// adl_getMem() aligns blocks on 32 bytes and takes 16 bytes overhead
static reserved_size( int requested) {
  return ((requested + 16 + 31) & ~31); 

int USEFUL_MEM = 0, // memory you actually asked for
    RESERVED_MEM = 0; // how much has been blocked due to alignment and overhead

void *memGetAndLog( size_t len) {
   void *block = adl_memGet( len + sizeof( size_t));
   if( ! block) { /* Barf */ }
   USEFUL_MEM += len;
   RESERVED_MEM += reserved_size( len);
   *(size_t*) block = len;

   return (void*) ((size_t*)block + 1);

void memReleaseAndLog( void *p) {
  size_t *plen = p; plen--;
  USEFUL_MEM -=*plen;
  RESERVED_MEM -= reserved_size( *plen);
  adl_memRelease( plen);

Then put some alias to map mem operations on the logging ones:

void *memGetAndLog( size_t len);
void memReleaseAndLog( void *p);
#define adl_memGet memGetAndLog
#define adl_memRelease memReleaseAndLog