Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Re: IB Gateway Memory Leak?
¿ªÔÆÌåÓý
I finally found some time to look into this.? Attached is a simple Java class that reproduces the issue.? It's around 700 lines of code, but most of that code is unimplemented required overloads.? When I started the program, IB Gateway was consuming 700 MB
and after running the code (which took around 30 mins), the process was consuming over 4 GB.? The leak seems to be coming from request contract details (for option contracts).? Or at least that is the call that most contributes to the memory leak for my use
case.? Importantly, IB Gateway still consumed 4 GB even after my attached puller program was closed.? I used JConsole to request several garbage collections on the IB Gateway, but that did not free up any memory.? If I leave the IB Gateway at the default max
memory limit (768 MB I think), it will freeze up after only a few symbols.? My current work around is to use a very large memory limit and I have enough system memory to do that.? Interestingly, while I was looking at the IB Gateway using JConsole, I noticed
that it had over 17,000 classes loaded.? That gives me some clue as to why it takes TWS so long to load...
I submitted a ticket with IB, but their uploader did not allow me to upload the attached source code.? So hopefully they will follow-up.? If course, you find find something in my code that I am doing wrong, please let?me know.? However, I don't see how my program
could cause a memory leak in their separately-executing process and why it would still persist even after my program terminates.
From: [email protected] <[email protected]> on behalf of Ray Racine <ray.racine@...>
Sent: Thursday, June 24, 2021 9:16 AM To: [email protected] <[email protected]> Subject: Re: [TWS API] IB Gateway Memory Leak? ?
Been a long while since my java days ...
But you did ask about some possible things ...
AFAIK all of the JVM suppliers offer a tool or a procedure (send a POSIX signal to the JVM process)? to force a gc collection as well as a heap dump, event attaching an external monitor to a running? JVM etc.
Doing it low level and a bit raw (there are free and vendor supplied higher level tools for all this):
You should clearly see some (it is usually one thing) run away count of object instances of some Class causing the leak.? It is rarely the class itself that is the issue, it is its use as an element of some collection container which makes it reachable
thus? preventing gc'ing.
For an actionable bug report just hitting memory allocation hard for some duration to a "steady state", force gc, dump gc stats, hitting allocation hard again for 5-10 mins, force gc, dump gc stats should be sufficient.
On Wed, Jun 23, 2021 at 1:46 AM Crow <aaroncook394@...> wrote:
|
to navigate to use esc to dismiss