Results 1 to 7 of 7

Thread: ActiveX dll not letting go [Resolved]

  1. #1

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    ActiveX dll not letting go [Resolved]

    Hi,

    I created an ActiveX DLL on my web server. In an ASP 3.0 app, I call:
    VB Code:
    1. Set objFactory = Server.CreateObject("prjVerbatron.clsFactory")
    Then,
    VB Code:
    1. Set objFactory = Nothing
    However, the project file is then locked, and I cannot replace the ActiveX DLL with a new version when I try to recompile the project. I get a "permission denied" error when I try to over-write my DLL.

    If I go to my task manager, and kill the "dllhost.exe" with the webserver username, then I can over-write the file. That seems wrong to me, like I am not doing some needed garbage collection.

    The class is very simple, and does not instantiate anything.

    Is this normal?

    Thanks!
    Last edited by Dave Sell; Sep 25th, 2004 at 11:07 AM.

  2. #2
    Lively Member
    Join Date
    Sep 2004
    Posts
    74
    Seems to me that the 'using' app is somehow not decreasing the Ref count of the ActiveX.
    This has little to do with garbage collection as the activeX tech is from before garbage collection.

    Liitle background info about com technology, everytime an ActiveX/DLL (com componet actually) is created by an using App the Ref is increased by one, the opposit is also thru (if everything is done correctly at design time of the Com component) when an App stops using the DLL/ActiveX then the Ref should be decreased, when Ref reaches Zero windows is signalled that it's no longer needed and it can be unloaded from memory.
    And my best bet would be that the REF counter isn't decreased

  3. #3

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    I bet I know what the problem is.

    I am not following my own rules. I have a rule: "the scope that Creates must be the scope that Destroys"

    I am Creating in the clsFatory and Destroying in the ASP Client app. I bet this is causing the problem, eh?

    I will do this again, but have 2 members on the factory:

    - CreateAggregate
    - DestroyAggregate

    Maybe then it will behave correctly.

  4. #4
    Lively Member
    Join Date
    Sep 2004
    Posts
    74
    Originally posted by Dave Sell
    I bet I know what the problem is.

    I am not following my own rules. I have a rule: "the scope that Creates must be the scope that Destroys"

    I am Creating in the clsFatory and Destroying in the ASP Client app. I bet this is causing the problem, eh?

    I will do this again, but have 2 members on the factory:

    - CreateAggregate
    - DestroyAggregate

    Maybe then it will behave correctly.
    Spot on,
    in COM tech it's imperitive that the routine that creates also is the routine that destroy's.
    The routine that increments the REF, should also be the routine that decreases the REF.
    Otherwise you might forget it sometimes and you get memoryleaks.
    Thios is almost the first lesson in the COM course of MS of the MCSD C++

  5. #5

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Resolved

    Well I changed the behavior of the system so that the factory Creates an Aggregate on Class_Creation and Destroys it on Class_Termination.

    I still see the dllhost.exe entry like before, but without terminating that process, I can overwrite the AvticeX EXE with a fresh re-compilation!

    You were right, I was not making proper usage of the COM paradigm!

    Thanks!

  6. #6
    Junior Member
    Join Date
    Nov 2002
    Posts
    25

    Re: ActiveX dll not letting go [Resolved]

    That's fine, although here's a simple example where an app calls a DLL which prompts a message box and nothing else. Can you explain why i'm having the same problem when all i'm doing is the following:

    My DLL:
    Public Function Test()
    MsgBox "Test"
    End Function

    ------------------------------------

    My App calling the DLL:
    Dim obj As Object

    Set obj = CreateObject("Test.Class1")
    Call obj.test
    Set obj = Nothing

  7. #7

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: ActiveX dll not letting go [Resolved]

    This is from ASP 3.0?
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width