How can I find the proportion of storage space and dynamic memory used by libraries alone in my arduinon sketch?
I am.having one strange issue in my sketch being compiled for Atmega328p, 5v, 16MHz, Arduino Mini Pro wherr the sketch works fine when the sketch size is consuming upto 94% storage space and 58% dynamic memory. Now if I add one more function which increases the storage size upto 96% and dynamic memory upto 61%, the devices like OLED and Neoring, in fact the whole sketch fails to start.
What could be the issue, and how can I optimize the memory usage in my sketch?
How can I find the proportion of storage space and dynamic memory used by libraries alone in my arduinon sketch?
In short: you cannot. The easiest way is to compile with and without the library and see what the compiler output tells you. But the RAM usage is only provided for the global variables, you won't see the the dynamically allocated memory.
What could be the issue, and how can I optimize the memory usage in my sketch?
The SSD1306 OLED library allocates memory for every pixel on the display and that memory is allocated dynamically (at runtime). On an ATmega328p based board that (128x64 version) takes almost half of the available memory (940 bytes of 2048 bytes).
Optimizations in the sketch are often done by using the F() macro to move constant strings to the flash memory (or better not storing it twice, in the flash and in the RAM).