So #373 gets freed in clientRequestNew and the "1", "2", ... markers are from printf's that divide up the function:
JsVar *clientRequestNew(SocketType socketType, JsVar *options, JsVar *callback) {
printf("clientRequestNew\n");
JsVar *arr = socketGetArray(HTTP_ARRAY_HTTP_CLIENT_CONNECTIONS,true);
if (!arr) return 0;
JsVar *req, *res = 0;
printf("1\n");
if ((socketType&ST_TYPE_MASK)==ST_HTTP) {
res = jspNewObject(0, "httpCRs");
printf("2\n");
if (!res) { jsvUnLock(arr); return 0; } // out of memory?
req = jspNewObject(0, "httpCRq");
} else {
req = jspNewObject(0, "Socket");
}
printf("3\n");
if (req) { // out of memory?
socketSetType(req, socketType);
printf("4\n");
if (callback != NULL)
jsvUnLock(jsvAddNamedChild(req, callback, HTTP_NAME_ON_CONNECT));
printf("5\n");
jsvArrayPush(arr, req);
if (res)
jsvObjectSetChild(req, HTTP_NAME_RESPONSE_VAR, res);
printf("6\n");
jsvObjectSetChild(req, HTTP_NAME_OPTIONS_VAR, options);
}
jsvUnLock2(res, arr);
printf("x clientRequestNew\n");
return req;
}
So the proto somehow gets freed in jspNewObject(0, "httpCRq"); on the 255-th request... Mhhh, is the reference or lock count perhaps a byte and only allows 255 references/locks? Does this mean the problem is that the httpCRq object that gets created for each request doesn't get freed or unlocked somewhere?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Here's the debug output:
So #373 gets freed in clientRequestNew and the "1", "2", ... markers are from printf's that divide up the function:
So the proto somehow gets freed in
jspNewObject(0, "httpCRq");
on the 255-th request... Mhhh, is the reference or lock count perhaps a byte and only allows 255 references/locks? Does this mean the problem is that the httpCRq object that gets created for each request doesn't get freed or unlocked somewhere?