on 01-17-2018 5:14 PM
Hi guys.
I have a regular NVO (call it NVO1) that has an autoinstantiate NVO (lets call it NVO2) as an instance object. This autoinstante nvo opens a connection to the DB on its constructor, and calls a disconnect on its destructor.
// Sample:
NVO1 >> instance variables: NVO2 iuo_2
NVO2.constructor: connect;
NVO2.desctructor: disconnect;
My code:
NVO1 luo_1
// At this moment, I have only 1 connection open to the DB
luo_1 = Create NVO1
// Now I have 2 connections open, because of the autoinstantiate of it's instance nvo. All good.
Destroy luo_1
// Here's the thing, it didn't disconnect. The connection remais open.
// Only when I close the application the connections are closed. Even calling GarbageCollect does not help.
// This sample code is used in a loop, so I'm reaching "maximum number of connections" on the DB server rather quickly. I'm on PB12.5.
Any thoughts on this? The changes to rebuild NVO2 will be substantial. 😞
Hi Daniel;
This is normal PBVM behaviour and not a bug. Most people do not realize that when you use the Auto-Instatiate (AI) feature, the PBVM issues a create for the object but does not destroy the object right away when the parent is destroyed. Instead, the PVBM only "marks" the AI object as a "potential" to destroyed and then carries on its merry way - leaving the AI object instantiated. If the AI object is used frequently ( and here is the PBVM's thought ) - then why not leave it instantiated in the class pool (even though its "to be deleted" ) so that I can just reuse its pointer and save the instantiation process. Thus, better performance.
The AI "to be deleted" object pile is only actioned by the PBVM when the entire App is minimized. So most likely, you are getting caught in the AI normal behaviour trying to out-think your App for better performance. The best approach in this implementation is to not use the AI feature for this processing and do the CREATE and DESTROY implicitly from the parent object.
HTH
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.