Memory issues

I am writing the code for a “ESP8266 Thing”, which contains the following devices: 4 relays, 4 RFID, 4 switches and an RS485 port.

When I make the call:
“HTTP: // IP Address” I get a Json document, containing all the descriptions of the device. It takes up 8 Kb.

The call:
“HTTP: // IP Address / things / GetRFID” fills 800 bytes

Question 1: Why did the first call, return all the device descriptors, was it not enough, to return each device’s “Href”?

Question 2:
When the gateway discovers devices, it eats approx. 16 Kb. from heap. Is it 2 x Large_Json_Document_Size?

Question 3:
Must “LARGE_JSON_DOCUMENT_SIZE” be set to 8 kb in order to execute the 8 Kb “HTTP: // IP Address”?

Question 4: Is there a recommended minimum, for available Heap?

Question 1: Why did the first call, return all the device descriptors, was it not enough, to return each device’s “Href”?

Because that’s what the spec dictates.

Question 2: When the gateway discovers devices, it eats approx. 16 Kb. from heap. Is it 2 x Large_Json_Document_Size?

When the gateway discovers the device, it does a number of things, so 2x is probably right.

Question 3: Must “LARGE_JSON_DOCUMENT_SIZE” be set to 8 kb in order to execute the 8 Kb “HTTP: // IP Address”?

Yes.

Question 4: Is there a recommended minimum, for available Heap?

No, as every situation is different.