IP Library › Granted Patent US 12,282,381
Granted Patent B2
US 12,282,381 · App. 18/151,506 · Granted Apr 22, 2025

Determining origins of memory leaks in source code

Inventors: Donald Alexander Bourne (Toronto, CA); Kevin Grigorenko (San Diego, CA); Gireesh Punathil (Kannur, IN)
Assignee: International Business Machines Corporation
G06F11/0778G06F11/0772
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,282,381
App. No.
18/151,506
Granted
Apr 22, 2025
Kind
B2
Abstract

A computer-implemented method, a computer program product, and a computer system for determining origins of memory leaks in source code. A computer system writes a first memory dump, in response to a memory leak being detected. A computer system searches the first memory dump to determine types of suspect leaking collections. A computer system creates identifiers for respective instances of each of the types. A computer system writes a second memory dump, in response to a continued memory leak being detected. A computer system determines which unique identifiers from the second memory dump correspond to growing collection objects of the types. A computer system tracks code paths of calls that add objects to collections whose identifiers match one of the unique identifiers. A computer system logs the code paths for review by developers.

Claims (29)

1. A computer-implemented method for determining origins of memory leaks in source code, the method comprising: in response to a memory leak being detected, writing a first memory dump; searching the first memory dump to determine types of suspect leaking collections; creating unique identifiers for respective instances of each of the types; in response to a continued memory leak being detected, writing a second memory dump; determining which unique identifiers from the second memory dump correspond to growing collection objects of the types; adding code to methods of the types of the suspect leaking collections to make the methods uniquely label the respective instances when a next time the methods are called for the respective instances; tracking code paths of calls that add objects to collections whose identifiers match one of the unique identifiers; and logging the code paths for review by developers.

2. The computer-implemented method of claim 1 , further comprising:

monitoring for signs of the memory leak; and

monitoring for signs of the continued memory leak.

3. The computer-implemented method of claim 1 , further comprising:

adding code to methods of suspect leaking collection types that add objects to a collection instance; and

wherein the code determines whether the collection instance being called matches an identifier of a suspect leaking collection instance.

4. The computer-implemented method of claim 1 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to write the first memory dump, wherein the target process writes the first memory dump on storage storing memory dumps and stack traces.

5. The computer-implemented method of claim 1 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to write the second memory dump, wherein the target process writes the second memory dump on storage storing memory dumps and stack traces.

6. The computer-implemented method of claim 1 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to log the code paths, wherein the target process logs the code paths on storage storing memory dumps and stack traces.

7. A computer program product for determining origins of memory leaks in source code, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by one or more processors, the program instructions executable to: in response to a memory leak being detected, write a first memory dump; search the first memory dump to determine types of suspect leaking collections; create unique identifiers for respective instances of each of the types; in response to a continued memory leak being detected, write a second memory dump; determine which unique identifiers from the second memory dump correspond to growing collection objects of the types; add code to methods of the types of the suspect leaking collections to make the methods uniquely label the respective instances when a next time the methods are called for the respective instances; track code paths of calls that add objects to collections whose identifiers match one of the unique identifiers; and log the code paths for review by developers.

8. The computer program product of claim 7 , further comprising the program instructions executable to:

monitor for signs of the memory leak; and

monitor for signs of the continued memory leak.

9. The computer program product of claim 7 , further comprising the program instructions executable to:

add code to methods of suspect leaking collection types that add objects to a collection instance; and

wherein the code determines whether the collection instance being called matches an identifier of a suspect leaking collection instance.

10. The computer program product of claim 7 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to write the first memory dump, wherein the target process writes the first memory dump on storage storing memory dumps and stack traces.

11. The computer program product of claim 7 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to write the second memory dump, wherein the target process writes the second memory dump on storage storing memory dumps and stack traces.

12. The computer program product of claim 7 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to log the code paths, wherein the target process logs the code paths on storage storing memory dumps and stack traces.

13. A computer system for determining origins of memory leaks in source code, the computer system comprising one or more processors, one or more computer readable tangible storage devices, and program instructions stored on at least one of the one or more computer readable tangible storage devices for execution by at least one of the one or more processors, the program instructions executable to: in response to a memory leak being detected, write a first memory dump; search the first memory dump to determine types of suspect leaking collections; create unique identifiers for respective instances of each of the types; in response to a continued memory leak being detected, write a second memory dump; determine which unique identifiers from the second memory dump correspond to growing collection objects of the types; add code to methods of the types of the suspect leaking collections to make the methods uniquely label the respective instances when a next time the methods are called for the respective instances; track code paths of calls that add objects to collections whose identifiers match one of the unique identifiers; and log the code paths for review by developers.

14. The computer system of claim 13 , further comprising the program instructions executable to:

monitor for signs of the memory leak; and

monitor for signs of the continued memory leak.

15. The computer system of claim 13 , further comprising the program instructions executable to:

add code to methods of suspect leaking collection types that add objects to a collection instance; and

wherein the code determines whether the collection instance being called matches an identifier of a suspect leaking collection instance.

16. The computer system of claim 13 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to write the first memory dump and second memory dump, wherein the target process writes the first memory dump and the second memory dump on storage storing memory dumps and stack traces.

17. The computer system of claim 13 , wherein an automated process of determining the origins of the memory leaks requests a target process monitored for the memory leaks to log the code paths, wherein the target process logs the code paths on storage storing memory dumps and stack traces.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 9, 2023
From: BOURNE, DONALD ALEXANDER; GRIGORENKO, KEVIN; PUNATHIL, GIREESH
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 062307/0251 →
Continuity (1)
Related Publication 20240231988A1 · Jul 11, 2024
References Cited (20)
US 7313661B1 · Dmitriev · 2007 [cited by applicant]
US 9760464B1 · Helliwell · 2017 [cited by examiner]
US 9824005B1 · Helliwell · 2017 [cited by examiner]
US 10534643B2 · Chan · 2020 [cited by applicant]
US 11080125B1 · Raj · 2021 [cited by applicant]
US 20070074149A1 · Ognev · 2007 [cited by examiner]
US 20080046673A1 · Hwang · 2008 [cited by examiner]
US 20080072007A1 · Zagatta · 2008 [cited by applicant]
US 20080209404A1 · Brady · 2008 [cited by examiner]
US 20080294936A1 · Hogstrom · 2008 [cited by examiner]
US 20090328007A1 · Chen · 2009 [cited by applicant]
US 20140189438A1 · Arbel · 2014 [cited by applicant]
US 20160055043A1 · Chikabelapur · 2016 [cited by applicant]
US 20160070633A1 · Abraham · 2016 [cited by examiner]
US 20160321130A1 · Takamiya · 2016 [cited by applicant]
US 20170277623A1 · Kawachiya · 2017 [cited by applicant]
US 20170337085A1 · Chan · 2017 [cited by applicant]
Viorel Alexandru; “Memory Dumps to Study a Memory-Leak Performance Issue”; Microsoft.com Techcommunity Blog [Full URL found in ref.]; Jul. 23, 2021 (Year: 2021). [cited by examiner]
“C# and C++ Memory Leak Detector—Memory Validator 9.50”; SoftwareVerify.com wepage as captured by the Wayback Machine Internet Archive (archive.org) [full URL found in ref.] on Dec. 12, 2022 (Year: 2022). [cited by examiner]
Disclosed Anonymously, “Faster detection of Java memory leak from a huge heap dump”, An IP.com Prior Art Database Technical Disclosure, IP.com No. IPCOM000217107D, IP.com Electronic Publication Date: May 3, 2012, 5 page… [cited by applicant]