Go Down

Topic: Comments don't have any effects (Read 159 times) previous topic - next topic

Olstrom

Apr 28, 2016, 10:37 pm Last Edit: Apr 28, 2016, 11:04 pm by Olstrom
Hello,

I encounter a problem with the memory used by a library. I need to decrease the memory used by this library. The library is GSM.h. It's not a problem about GSM, it's only about the memory used by this file.

I include GSM.h in the main file : #include GSM.h
when I comment this line, the memory used by GSM.h is released, as we might guess.

GSM.h includes all the other files about GSM:
Code: [Select]
#include <GSM3MobileCellManagement.h>
#include <GSM3MobileClientService.h>
#include <GSM3MobileNetworkRegistry.h>
#include <GSM3MobileServerService.h>
#include <GSM3ShieldV1AccessProvider.h>
....
....


Now, I uncomment #include GSM.h within the main file, and I comment all these lines in GSM.h. It has no effect. The memory used by the library is still the same.

I don't get why. I tried to see if the file is the same that the one linked. The linker says "Using library GSM at version 1.0.5 in folder: C:\Program Files (x86)\Arduino\libraries\GSM ". I edit the same file.

Moreover, if these lines (sub libraries) are commented, and if I try to used an object from these sub-libraries, like GSMClient, the builder says :
"GSM_manager.cpp:10: error: 'GSMClient' does not name a type"
Which confirms that these sub libraries are not really included. Thus the comments work.

I don't get why the memory used is still the same, whatever the lines are commented or not. If these lines are commented, it should not link these files, therefore I should not use the memory of these files.

Olstrom

#1
Apr 28, 2016, 11:18 pm Last Edit: Apr 28, 2016, 11:23 pm by Olstrom
I tried another test to understand. I moved all the "sub library" files to another place (my Desktop). Now, the memory is free.

Therefore, if these files are inside the same directory than GSM.h, their memory are taken into account. if these files are not in the same place, their memory are not taken into account..

WHy???

KeithRB

Because the IDE is stupidly helpful.

Go Up