.NET woes
2002-10-12 02:22:15+00 by
Dan Lyke
5 comments
Sigh. It is my belief that, in a language that claims to manage memory for you, the act of creating a Bitmap
object and assigning that Bitmap
to the .Image
member of an image control, then repeating that process with a different bitmap (discarding all my own references to previous images) should not cause the computer to run out of memory. Further, if said language had shortcuts because its garbage collector is apparently b0r|<3n, it would be nice if one could do something like ctrl.Image.Dispose(); ctrl.Image=null
rather than temp=ctrl.Image; ctrl.Image=null; temp.Dispose()
without causing the runtime environment to give one the hairy eyeball. Just saying.
And this isn't even harping on all of the missing attributes of controls, like a background color on a Tab, which lead the VisualBasic programmer I work with to say "Wow, .NET really isn't finished yet. I had no idea how bad it was".
Of course we'll leave off why one would be changing background colors from the Windows standards to custom values as a rant on another topic...
[ related topics:
Microsoft Software Engineering moron Work, productivity and environment
]
comments in ascending chronological order (reverse):
#Comment made: 2002-10-12 02:37:03+00 by:
TheSHAD0W
Couldn't you write in a "ctrl.Image.autodispose" function?
#Comment made: 2002-10-12 02:38:15+00 by:
meuon
The Microsoft SWAT team has been notified, you must be a poser and not "of the fold". They are designing a re-education program for you and will have it ready by tomorrow (if they survive the reboots).
I spent some time showing off differences in Unix(Linux) systems and X-Windows to a MS-Dude yesterday, when I did a few lines of perl,
and then some PHP examples he almost cried.
But you are pointing out fundemental flaws, if it will not re-allocate memory, it is broke badly.
#Comment made: 2002-10-12 16:15:58+00 by:
Mike Gunderloy
If you're thrashing those bitmaps quickly enough, the garbage collector may not be getting a time slice to run - .NET treats this as a low (too low, in my opinion) priority task. You might take a look at System.GC.Collect.
#Comment made: 2002-10-12 20:00:00+00 by:
Shawn
This broken garbage collection phenomenon with regards to image/picture members is also present in VB6. I wrote a slideshow screensaver that suffers the same malady.
#Comment made: 2002-10-12 20:26:59+00 by:
Dan Lyke
I'm actually only changing the bitmaps once every 6 to 10 seconds. Since the real problem is that this takes up lots of memory, then we go off and call some unmanaged code to do the real processing and the C# threads are pretty much dormant at that point, so the .NET runtime probably doesn't see the need for the memory.
Thanks for the System.GC.Collect
reference, I'll try that.
How come systems which are supposed to protect us from memory management concerns always make code more complex rather than simpler?