Initializing Memory

Don't have a Giga, but looking at some example code

void frameBuffer() {
    // In case we want a framebuffer-like area at the beginning of the flash,
    // simply initialize the memory as

    SDRAM.begin(SDRAM_START_ADDRESS + 2 * 1024 * 1024);
    // 2MB of contiguous memory available at the beginning

    uint32_t* framebuffer = (uint32_t*)SDRAM_START_ADDRESS;

    // We can't allocate anymore the huge 7MB array

    uint8_t* myVeryBigArray = (uint8_t*)SDRAM.malloc(7 * 1024 * 1024);
    if (myVeryBigArray == NULL) {
        Serial.println("Oops, too big :)");
    }

}

Did the call to SDRAM.begin set aside space for a framebuffer, that would not be used as "plain RAM" with malloc?

How big is DATA_BASE_SIZE_CHAR?

Just checking: did the malloc actually succeed, or did it return nullptr?

Minor points:

  • If pDatabaseHead is already an unsigned char *, why cast it again to pass it to memset?
  • There's no need to cast, since memset takes void *: any pointer will do
  • pDatabaseHead[i] reads better and is easier to type than *(pDatabaseHead+i)