Description
- Version: v12.8.0
- Platform:
Linux atc 5.1.20-300.fc30.x86_64 #1 SMP Fri Jul 26 15:03:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem:
This is again with respect to the node-oracledb driver (Oracle Database driver for Node.js). I have adjusted the code once again to eliminate any requirement for an Oracle database. I'll attach the test case shortly after this issue is created.
For Oracle Objects I have created a class dynamically at run-time based on the name. This can be seen in the test case as a call to conn.getDbObjectClass()
. Internally, the call to conn.getDbObjectClass()
calls into a C module which then makes a call to conn._getDbObjectClassJS()
. This function then builds the class and stores the result in a cache on the connection called _dbObjectClasses
.
When the connection is closed by a call to conn.close()
, I have to iterate over the entries in the cache and deliberately break the prototype chain; otherwise, the classes that are built are never garbage collected.
But, even if I do that and the classes are garbage collected, there is still a memory leak. The pattern shows that there are periods of relatively stable memory usage followed by jumps in memory usage. The periods of stable memory usage grow longer as the number of iterations increases but the jump in memory also increases. It would seem that a list of some kind is being populated with intermittent, increasing size allocation. Looking at the heap memory in the Chrome development tools indicates that the memory is all found in noscript_shared_function_infos
-- but I'm not sure what that means! Interestingly, though, if I remove the call to napi_define_properties
in njsDbObjectType_populate()
, the memory leak goes away.
I'm not sure if this is related to the fix introduced in PR #27805 or not, but version 12.0 is the first version that has this issue. Prior to 12.0 the code suffers from the memory leak that that issue corrected.
I hope this is sufficient to discover the source of this issue. Let me know if you need anything else!