# Freeing objects used in requests, when using note-c

**URL:** <https://discuss.blues.com/t/freeing-objects-used-in-requests-when-using-note-c/3194>\
**Category:** Tools & SDKs\
**Created:** [July 28, 2025, 11:24am UTC](https://discuss.blues.com/t/freeing-objects-used-in-requests-when-using-note-c/3194 "2025-07-28T11:24:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkerenergy](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@darkerenergy](https://discuss.blues.com/u/darkerenergy)\
**Post date:** [July 28, 2025, 11:24am UTC](https://discuss.blues.com/t/freeing-objects-used-in-requests-when-using-note-c/3194/1 "2025-07-28T11:24:57Z")

</div>

Hi -  
I’m using the note-c library. Let’s say I want to create a Note, to be sent to Notehub. I’ll use something like this:

J \*req = NoteNewRequest(“note.add”);  
JAddStringToObject(req, “file”, “readings.qo”);  
…  
J \*rsp = NoteRequestResponseWithRetry(req, 5);

But I have to add a body to the Note. I’m assuming I do that something like this:

J \*body = JAddObjectToObject(req, “body”);  
JAddNumberToObject(body, “p1”, 12);

But now I’m puzzled. Once I have called:

J \*rsp = NoteRequestResponseWithRetry(req, 5);

I understand that “the passed in request object is always freed”, per the note-c documentation, but does the nested object “body” automatically get freed too, or is my code responsible for calling JDelete(body)?

---

<div class="post-metadata">

**Author:** ![zfields](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/zfields/32/29_2.png) [@zfields](https://discuss.blues.com/u/zfields)\
**Post date:** [July 28, 2025, 11:39am UTC](https://discuss.blues.com/t/freeing-objects-used-in-requests-when-using-note-c/3194/2 "2025-07-28T11:39:08Z")

</div>

Hello @darkerenergy,

Great question!

The entire Note is freed using `JDelete`, which performs a recursive deletion of the object (i.e. deletes all child nodes).

Happy hacking,  
Zak

---

<div class="post-metadata">

**Author:** ![darkerenergy](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@darkerenergy](https://discuss.blues.com/u/darkerenergy)\
**Post date:** [July 28, 2025, 11:56am UTC](https://discuss.blues.com/t/freeing-objects-used-in-requests-when-using-note-c/3194/3 "2025-07-28T11:56:00Z")

</div>

Hi Zak -

Thanks for the amazingly prompt response! I was kinda hoping that would be the case.

Cheers.
