 |
|
 |
If I wasn't boycotting the voting process I'd lynch vote you a 1 for asking what is clearly a programming question in the lounge.
"It's so simple to be wise. Just think of something stupid to say and then don't say it."
-Sam Levenson
|
|
|
|
 |
|
 |
Mate, I reckon this falls smakc-bang in the middle of the big circle marked 'Programming questions'
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
 |
|
 |
To be honest, I wasn't asking, "How can I avoid this memory leak?"
I expected an answer like "Tool X can do this for you", or "You're buggered, you'll have to review the whole code and do it by hand".
If this still qualifies as a programming question, my unqualified apologies.
Cheers,
Vıkram.
I don't suffer from insanity, I enjoy every moment of it.
|
|
|
|
 |
|
 |
I almost never 1 vote people.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
 |
|
 |
Now there's a straight line:
"... only their darn stupid questions."
"... monkeys on the other hand..."
|
|
|
|
 |
|
 |
I ran into a similar problem a while back, but we owned the code for the type (you could always disassemble/assemble).
My solution was to store the stack trace of the constructor of every instance of that type as a member in that type, and then in the finalizer, log the stack trace. I also ran a timer in the background that periodically called GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect();. That way, the finalizer would run for all instances that did not get disposed, and I would be able to see where those instances got created.
I would then run the application and try to exercise all paths in the code that deal with that type. I would then go through the log and fix code that was not disposing instances.
The trick is to make sure that all code paths that involve that type are exercised, and that's what makes this non-deterministic. A tool like NCover would probably help track code coverage.
You just gave me an idea - it would be nice to have a tool automate the first part (track instances and report where they are created in code). Now I know what I'll be doing over the Republic Day weekend
Hope this helps.
|
|
|
|
 |
|
 |
Thanks for your reply, Senthil.
Making any changes to the type itself is out of question. I ploughed through the code today, adding Dispose() calls, and will see tomorrow if it has had any effect. If not, I'll go with your idea of logging the stack trace by inheriting the class (I hope they didn't seal it ) and replacing all HDElement instances with my subclass.
Send me the link when your article is ready
Cheers,
Vıkram.
I don't suffer from insanity, I enjoy every moment of it.
|
|
|
|
 |
|
 |
If you are still working on fixing the leak, I have a basic version of my app here[^]. It uses the CLR Profiling API to track object allocations and finalizations and shows the constructor stack trace for finalized objects.
Just give it the list of fully qualified names (including namespace) of the types you want to monitor and run the application - It will log all data to a file you specify.
It has a couple of kinks - you'll have to give some type name i.e. you can't monitor all types, inner classes don't work if the class name is fully qualified, and the stack trace doesn't include method parameter/return types.
Worth a try if you are still struggling with the leak
|
|
|
|
 |
|
 |
Senthil, this is much appreciated. I later realized the numbers I was seeing in task manager were not accurate, and found some articles that demonstrated this (the bookmarks are at work).
I have come around to the conclusion that there is probably no leak, but all that work did not go waste: I was able to bring down the memory usage by more than 25% by rewriting the code to use Dispose() and making a few calls to GC.Collect().
I've downloaded and mailed your app to my office ID so I can play with it on Monday (I don't do any dev work at home).
Again, many thanks!
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
 |
|
 |
Vikram A Punathambekar wrote:
Send me the link when your article is ready
Perhaps he's already done this, but in case he hasn't :
Finding undisposed objects[^]
|
|
|
|
 |
|
 |
Thanks!
I wanted to ask how you stumbled across this now, but I see he's included a link.
Cheers,
Vikram. (Proud to have finally cracked a CCC!) Recent activities:
TV series: Friends, season 10
Books: Fooled by Randomness, by Nassim Nicholas Taleb. Carpe Diem.
|
|
|
|
 |
|
 |
Please let me know if you are xml, xslt and xpath expert.
Cheers
Andyyy
|
|
|
|
 |
|
 |
You forgot to mention XML schema (yes, all those you mentioned I deem plain text if it does not have a schema)
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
 |
|
 |
cool so you are expert is all this.
Its time to learn XML, XSLT and XPath, so just wondering which book or ebook to follow. I have got this Michael Fitzgerland book which i think is no good. Any recommendation.
Note:- I have a basic understanding of these topics via W3C tutorial but i am now looking for intermediate and advance tutorials..
Cheers Mate...
Andyyyy
The one who makes you
|
|
|
|
 |
|
 |
AndyInUK wrote: Note:- I have a basic understanding of these topics via W3C tutorial but i am now looking for intermediate and advance tutorials..
The time is good now to good through the specifications, you dont really need to read it all, just scan the topic, see if you understand the concept, and move to the next.
The order how I would do it from the start: XML, XML Schema, XPath, XSLT.
So to sum it up in 1 line: XML is source code that conforms to a XML Schema that defines the semantics, then pattern-matched with XPath, and finally transformed into any other format with XSLT.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
 |
|
 |
So I spent 4 hours (2 x 2 hours), trying to figure out why a BindingList was going apeshit.
1. The fool that wrote the generated code (coming from an ORM tool), decided it would be a good idea to fire an event on a separate thread. Problem was easily solved by wrapping the BindingList and redirecting the event to a UI thread.
2. The same fool as above decided that using BeginInvoke (now I could see where the above issue came from), was a good idea to fire off PropertyChanging/PropertyChanged events. Subsequently, LINQ2SQL's object tracker 19/20 times could not detect that a property was changed and would not submit the data.
ARGGGGGGGGGGGGGGHHHHHHH!!!!!!
Problem solved now, hopefully tomorrow less issues
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
 |
|
 |
Stay in Office for 4 more hrs and you will get your 4 hrs back
|
|
|
|
 |
|
 |
After 11 hours at the office, no thanks
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
 |
|
 |
Wasn't LINQ2SQL obsolete?
Wout
|
|
|
|
 |
|
 |
wout de zeeuw wrote: Wasn't LINQ2SQL obsolete?
While is it allowing me to not have to write SQL, it will not be obsolete.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
 |
|
|
 |
|
 |
I found a hilarious one:
public int convertItoi(Integer v)
{
if (v.intValue()==1) return 1;
if (v.intValue()==2) return 2;
if (v.intValue()==3) return 3;
if (v.intValue()==4) return 4;
if (v.intValue()==5) return 5;
if (v.intValue()==6) return 6;
if (v.intValue()==7) return 7;
return 0;
}
modified on Tuesday, January 20, 2009 12:15 PM
|
|
|
|
 |
|
 |
Obviously not written by a programmer. Anyone caught writing that should be fired on the spot..
John
|
|
|
|
 |
|
 |
One would hope that THAT would be the effect. I could think of a few places where they still abound.
|
|
|
|
 |
|
 |
This site has been around for YEARS, and sadly only gets updated about once a year!
Does make for an amusing read from time to time.
------------------------------------
"The greatest tragedy in mankind's entire history may be the hijacking of morality by religion"
Arthur C Clarke
|
|
|
|
 |