Introduced changes for memory savings

Moved GattSecurityManager and GattClient to be allocated dynamically and
reduced the size of some arrays to increase memory savings.
This commit is contained in:
Andres Amaya Garcia 2015-10-29 11:39:00 +00:00
parent 18050e7068
commit 97a65815ed
4 changed files with 12 additions and 6 deletions

View file

@ -26,7 +26,7 @@ typedef struct {
UUID::LongUUIDBytes_t uuid;
uint8_t type;
} converted_uuid_table_entry_t;
static const unsigned UUID_TABLE_MAX_ENTRIES = 8; /* This is the maximum number of 128-bit UUIDs with distinct bases that
static const unsigned UUID_TABLE_MAX_ENTRIES = 4; /* This is the maximum number of 128-bit UUIDs with distinct bases that
* we expect to be in use; increase this limit if needed. */
static unsigned uuidTableEntries = 0; /* current usage of the table */
converted_uuid_table_entry_t convertedUUIDTable[UUID_TABLE_MAX_ENTRIES];

View file

@ -18,8 +18,11 @@
nRF5xGattClient &
nRF5xGattClient::getInstance(void) {
static nRF5xGattClient nRFGattClientSingleton;
return nRFGattClientSingleton;
static nRF5xGattClient* nRFGattClientSingleton = NULL;
if (nRFGattClientSingleton == NULL) {
nRFGattClientSingleton = new nRF5xGattClient();
}
return *nRFGattClientSingleton;
}
#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)

View file

@ -17,6 +17,9 @@
#include "nRF5xSecurityManager.h"
nRF5xSecurityManager &nRF5xSecurityManager::getInstance(void) {
static nRF5xSecurityManager m_instance;
return m_instance;
static nRF5xSecurityManager* m_instance = NULL;
if (m_instance == NULL) {
m_instance = new nRF5xSecurityManager();
}
return *m_instance;
}

View file

@ -85,7 +85,7 @@
* be stored. In such cases, application will be notified with DM_DEVICE_CONTEXT_FULL
* as event result at the completion of the security procedure.
*/
#define DEVICE_MANAGER_MAX_BONDS 4
#define DEVICE_MANAGER_MAX_BONDS 2
/**