Skip to content

(WifiS3 WiFiClient) Reduce memory allocations #407

Open
@ondra-novak

Description

@ondra-novak

Embedded devices should avoid to use memory allocation - or limit allocations to minimum. Unfortunately, the code for WiFi does not honour this rule.

  • don't use std::string, use static allocated buffer
  • don't use std::make_shared - we have C++17, implementing copy constructors for every class is no longer required. WiFiClient can have preallocated buffer as member variable. The programmer can possibly choose to use std::make_shared for the whole WiFIClient instance, if it needs to share it by other objects.
  • typo: destroy_at_distructor
  • bug: the flag destroy_at_distructor is never used, destructor is empty.

WiFiClient::WiFiClient() : _sock(-1), destroy_at_distructor(true), rx_buffer(nullptr) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvementtype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions