Reduced size by 706 bytes by removing virtual destructors.

This commit is contained in:
Benoit Blanchon
2014-11-08 17:13:41 +01:00
parent 1c450fd3aa
commit d8dbfe6e6d
2 changed files with 4 additions and 2 deletions

View File

@ -20,7 +20,10 @@ class JsonObject;
// fixed memory allocation. // fixed memory allocation.
class JsonBuffer { class JsonBuffer {
public: public:
virtual ~JsonBuffer() {} // CAUTION: NO VIRTUAL DESTRUCTOR!
// If we add a virtual constructor the Arduino compiler will add malloc() and
// free() to the binary, adding 706 useless bytes.
// virtual ~JsonBuffer() {}
// Allocates an empty JsonArray. // Allocates an empty JsonArray.
// //

View File

@ -17,7 +17,6 @@ template <size_t CAPACITY>
class StaticJsonBuffer : public JsonBuffer { class StaticJsonBuffer : public JsonBuffer {
public: public:
explicit StaticJsonBuffer() : _size(0) {} explicit StaticJsonBuffer() : _size(0) {}
virtual ~StaticJsonBuffer() {}
size_t capacity() const { return CAPACITY; } size_t capacity() const { return CAPACITY; }
size_t size() const { return _size; } size_t size() const { return _size; }