Results 1 to 5 of 5

Thread: Bad programming - help?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Location
    Manchester,UK
    Posts
    94

    Question Bad programming - help?

    I have been writing a whole suite of utilities for the past year and a half, mainly for my job but hopefully to sell at some point.

    Many components have been written very hurriedly to get a job done quickly and due to this it appears that something isn't being terminated correctly.

    What I need is to kill the prgram and then browse through all open objects using some sort of debugger.

    Stepping through code isn't really an option and if there is a tool in Visual Studio I can't find it.

    Please help, an Add-In would be ideal but any tips appreciated.


  2. #2
    Fanatic Member
    Join Date
    Feb 2002
    Location
    SE England
    Posts
    732
    You can loop through all loaded forms...

    Or put some debug code in the initialize and terminate event of each class to see which ones are not being disposed of..
    Leather Face is comin...


    MCSD

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Location
    Manchester,UK
    Posts
    94
    Unfortunately 100's of thousands of objects are initialised and terminated throughout the course of the programs use.

    I'm writing a new class to keep track of open/close descrepancies but actually finding where they occur is going to be a nightmare.

    One thing I've read is that collections can be tricky to rub completely. I have numerous collection and some items do refer back, maybe it's this.

    I also need to be able to calculate memory per object as memory usage is escalating dramatically.

    Any more tips?

  4. #4
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    Originally posted by London75
    Unfortunately 100's of thousands of objects are initialised and terminated throughout the course of the programs use.

    I can't believe you have a program with 100's of thousands classes in it.

    Try to use the initialize and terminate events of the classes like leather mentioned.

    If you instantiate one class a hundred times in your project
    then the initialize of this class will be called each time you create an instance of it.
    Put some code in it to keep track of times it is created and destroyed.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Location
    Manchester,UK
    Posts
    94
    There are about 20-30 classes depending on which tool I'm working on (it is a database administration package - one class per database object type).

    When the application connects to say a SQL Server it can drag the entire schema and OO it, (mainly for the purpose of cross platform migration of schema). If you think of a SQL Server with 10 databases each with 800 tables with an average of 4 indexes, 2 views, 500 columns and 3 stored procedures, the number of objects adds up.

    The class I'm writing to track open and close occurences will find descrepancies but what I really need is to be able to close the program and then browse all the open objects and determine their contents. This will enable me to find where the object refuses to close.

    For the most part it does close ok but I want it to be a bit neater, I'm only working on a 64Mb RAM machine.


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