IP Library Granted Patent US 12,379,963
Granted Patent B2
US 12,379,963 · App. 17/733,287 · Granted Aug 5, 2025

Managing temporal dependencies between sets of foreign resources

Inventors: Maurizio Cimadamore (Donabate, IE); Paul David Sandoz (Campbell, CA)
Assignee: Oracle International Corporation
G06F9/5016G06F9/5022G06F9/45558G06F2009/45583G06F12/0253
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,379,963
App. No.
17/733,287
Granted
Aug 5, 2025
Kind
B2
Abstract

Techniques for managing temporal dependencies between sets of foreign resources are disclosed, including: allocating, in a runtime environment, a segment of foreign memory to a first memory session, the runtime environment being configured to use a garbage collector to manage memory in a heap, and the foreign memory including off-heap memory that is not managed by the garbage collector; opening, in the runtime environment, a second memory session that descends from the first memory session; while the second memory session is open, encountering a request to close the first memory session; responsive to encountering the request to close the first memory session, determining that the first memory session has at least one open descendant memory session; responsive to determining that the first memory session has at least one open descendant memory session, declining the request to close the first memory session.

Claims (87)

1. One or more non-transitory machine-readable media storing instructions that, when executed by one or more processors, cause performance of operations comprising:

allocating, in a runtime environment, a segment of foreign memory to a first memory session, the runtime environment being configured to use a garbage collector to manage memory in a heap, and the foreign memory comprising off-heap memory that is not managed by the garbage collector;

opening, in the runtime environment, a second memory session that descends from the first memory session, wherein opening the second memory session that descends from the first memory session comprises:

receiving, by a function that instantiates the second memory session, a function call with a parameter comprising a first reference to the first memory session;

responsive to the function call:

instantiating the second memory session; and

storing a parent-child association between the first memory session and the second memory session; and

returning, as an output of the function that instantiates the second memory session, a second reference to the second memory session;

while the second memory session is open, encountering a first request to close the first memory session;

responsive to encountering the first request to close the first memory session, determining that the first memory session has at least one open descendant memory session; and

responsive to determining that the first memory session has at least one open descendant memory session, declining the first request to close the first memory session.

2. The one or more non-transitory machine-readable media of claim 1 , wherein determining that the first memory session has at least one open descendant memory session comprises:

searching a directed acyclic graph comprising (a) a plurality of nodes representing respective sessions and (b) one or more edges representing respective parent-child relationships between sessions;

determining that the one or more edges comprise(s) an edge between a first node that represents the first memory session and a second node that represents the second memory session.

3. The one or more non-transitory machine-readable media of claim 1 , the operations further comprising:

subsequent to declining the first request to close the first memory session, closing the second memory session;

subsequent to closing the second memory session, encountering a second request to close the first memory session;

responsive to encountering the second request to close the first memory session, determining that the first memory session does not have any open descendant memory sessions;

responsive to determining that the first memory session does not have any open descendant memory sessions, closing the first memory session.

4. The one or more non-transitory machine-readable media of claim 1 , the operations further comprising:

subsequent to declining the first request to close the first memory session, closing the second memory session;

opening, in the runtime environment, a third memory session that descends from the first memory session;

subsequent to closing the second memory session and while the third memory session is open, encountering a second request to close the first memory session;

responsive to encountering the second request to close the first memory session, determining that the first memory session has at least one open descendant memory session;

responsive to determining that the first memory session has at least one open descendant memory session, declining the second request to close the first memory session.

5. The one or more non-transitory machine-readable media of claim 1 , the operations further comprising:

encountering a request for the second memory session to borrow memory from the segment of foreign memory;

granting the request for the second memory session to borrow memory from the segment of foreign memory.

6. The one or more non-transitory machine-readable media of claim 1 , the operations further comprising:

maintaining a plurality of reference counters associated with the first memory session, the plurality of reference counters comprising (a) at least one reference counter for references originating in a first thread that owns the first memory session and (b) at least one reference counter for references originating outside the first thread.

7. A system comprising:

at least one device comprising one or more hardware processors,

the system being configured to perform operations comprising:

allocating, in a runtime environment, a segment of foreign memory to a first memory session, the runtime environment being configured to use a garbage collector to manage memory in a heap, and the foreign memory comprising off-heap memory that is not managed by the garbage collector;

opening, in the runtime environment, a second memory session that descends from the first memory session, wherein opening the second memory session that descends from the first memory session comprises:

receiving, by a function that instantiates the second memory session, a function call with a parameter comprising a first reference to the first memory session;

responsive to the function call:

instantiating the second memory session; and

storing a parent-child association between the first memory session and the second memory session; and

returning, as an output of the function that instantiates the second memory session, a second reference to the second memory session;

while the second memory session is open, encountering a first request to close the first memory session;

responsive to encountering the first request to close the first memory session, determining that the first memory session has at least one open descendant memory session; and

responsive to determining that the first memory session has at least one open descendant memory session, declining the first request to close the first memory session.

8. The system of claim 7 , wherein determining that the first memory session has at least one open descendant memory session comprises:

searching a directed acyclic graph comprising (a) a plurality of nodes representing respective sessions and (b) one or more edges representing respective parent-child relationships between sessions;

determining that the one or more edges comprise(s) an edge between a first node that represents the first memory session and a second node that represents the second memory session.

9. The system of claim 7 , the operations further comprising:

subsequent to declining the first request to close the first memory session, closing the second memory session;

subsequent to closing the second memory session, encountering a second request to close the first memory session;

responsive to encountering the second request to close the first memory session, determining that the first memory session does not have any open descendant memory sessions;

responsive to determining that the first memory session does not have any open descendant memory sessions, closing the first memory session.

10. The system of claim 7 , the operations further comprising:

subsequent to declining the first request to close the first memory session, closing the second memory session;

opening, in the runtime environment, a third memory session that descends from the first memory session;

subsequent to closing the second memory session and while the third memory session is open, encountering a second request to close the first memory session;

responsive to encountering the second request to close the first memory session, determining that the first memory session has at least one open descendant memory session;

responsive to determining that the first memory session has at least one open descendant memory session, declining the second request to close the first memory session.

11. The system of claim 7 , the operations further comprising:

encountering a request for the second memory session to borrow memory from the segment of foreign memory;

granting the request for the second memory session to borrow memory from the segment of foreign memory.

12. The system of claim 7 , the operations further comprising:

maintaining a plurality of reference counters associated with the first memory session, the plurality of reference counters comprising (a) at least one reference counter for references originating in a first thread that owns the first memory session and (b) at least one reference counter for references originating outside the first thread.

13. A method comprising:

allocating, in a runtime environment, a segment of foreign memory to a first memory session, the runtime environment being configured to use a garbage collector to manage memory in a heap, and the foreign memory comprising off-heap memory that is not managed by the garbage collector;

opening, in the runtime environment, a second memory session that descends from the first memory session, wherein opening the second memory session that descends from the first memory session comprises:

receiving, by a function that instantiates the second memory session, a function call with a parameter comprising a first reference to the first memory session;

responsive to the function call:

instantiating the second memory session; and

storing a parent-child association between the first memory session and the second memory session; and

returning, as an output of the function that instantiates the second memory session, a second reference to the second memory session;

while the second memory session is open, encountering a first request to close the first memory session;

responsive to encountering the first request to close the first memory session, determining that the first memory session has at least one open descendant memory session; and

responsive to determining that the first memory session has at least one open descendant memory session, declining the first request to close the first memory session,

wherein the method is performed by at least one device comprising one or more hardware processors.

14. The method of claim 13 , wherein determining that the first memory session has at least one open descendant memory session comprises:

searching a directed acyclic graph comprising (a) a plurality of nodes representing respective sessions and (b) one or more edges representing respective parent-child relationships between sessions;

determining that the one or more edges comprise(s) an edge between a first node that represents the first memory session and a second node that represents the second memory session.

15. The method of claim 13 , further comprising:

subsequent to declining the first request to close the first memory session, closing the second memory session;

subsequent to closing the second memory session, encountering a second request to close the first memory session;

responsive to encountering the second request to close the first memory session, determining that the first memory session does not have any open descendant memory sessions;

responsive to determining that the first memory session does not have any open descendant memory sessions, closing the first memory session.

16. The method of claim 13 , further comprising:

encountering a request for the second memory session to borrow memory from the segment of foreign memory;

granting the request for the second memory session to borrow memory from the segment of foreign memory.

17. The method of claim 13 , further comprising:

maintaining a plurality of reference counters associated with the first memory session, the plurality of reference counters comprising (a) at least one reference counter for references originating in a first thread that owns the first memory session and (b) at least one reference counter for references originating outside the first thread.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 3, 2022
From: CIMADAMORE, MAURIZIO; SANDOZ, PAUL DAVID
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 059801/0234 →
Continuity (1)
Related Publication 20230350716A1 · Nov 2, 2023
References Cited (17)
US 10223256B1 · Schneider et al. · 2019 [cited by applicant]
US 11023299B2 · Ritchie · 2021 [cited by examiner]
US 11106501B2 · Burriss · 2021 [cited by examiner]
US 11356382B1 · Goyal · 2022 [cited by examiner]
US 11422872B2 · Neilson · 2022 [cited by examiner]
US 20010037336A1 · Sauntry et al. · 2001 [cited by applicant]
US 20050028140A1 · Ayachitula et al. · 2005 [cited by applicant]
US 20090019249A1 · Kessler · 2009 [cited by applicant]
US 20120222005A1 · Harris et al. · 2012 [cited by applicant]
US 20150081978A1 · Daly · 2015 [cited by applicant]
US 20170139824A1 · Dragoljevic et al. · 2017 [cited by applicant]
US 20180136842A1 · Kim · 2018 [cited by examiner]
US 20190347211A1 · Bortnikov et al. · 2019 [cited by applicant]
US 20190379736A1 · Kravtsov · 2019 [cited by applicant]
US 20230005097A1 · Gurfinkel · 2023 [cited by examiner]
Cimadamore , “Foreign Memory Access—Pulling all the threads”, Retrieved at https://inside.java/2021/01/25/memory-access-pulling-all-the-threads/, Jan. 25, 2021, 6 Pages. [cited by applicant]
Cimadamore, “Resource Scope Dependencies”, Retrieved at https://inside.java/2021/10/12/panama-scope-dependencies/, Oct. 12, 2021, 9 Pages. [cited by applicant]