Re: buggy activity in compact .net app

From: Chris Tacke, eMVP (ctacke[at]Open_NET_CF[dot]org)
Date: 02/01/04


Date: Sun, 1 Feb 2004 12:11:05 -0500

The variable is destroyed, but there is nothing to guarantee immediate
disposal of the resources it needed. Calling Dispose (and maybe even
GC.Collect) would help the EE know what to do. Myself I'd probably use a
class-scoped variable for the bitmap that I create only once per app
instance. This would avoid the entire situation.

-Chris

"Sarah Smith" <nixdk@yahoo.dk> wrote in message
news:n49q101d24q4kfgmocpledcna2ggvm2sst@4ax.com...
>
> Hi Alex,
>
> thanks for your suggestions.
>
> I think the code is OK, and the error is a bug in the CF.
>
> I don't need to check the path (as you indicate below), because the
> path has been verified earlier.
>
> As for using .Dispose() on the bitmap object ... I don't think that is
> usefull either because the bitmap is created inside a routine.
>
> Like this:
>
> Dim strFullPath As String
> strFullPath = strRoot & "\" & strFilenames(nCount)
>
> If strFullPath = "" Then
> MsgBox("Error: path string empty!")
> Return
> End If
>
> Dim myBitMap As Bitmap
> myBitMap = MakeBitMap(strFullPath)
>
> If myBitMap Is Nothing Then
> MsgBox("Error with: " & strFilenames(nCount))
> Return
> End If
>
> I moved the code in the MakeBitmap() function just to handle debugging
> a little better. So as you can see, each time the code is ready to
> call the MakeBitMap() function, it creates a New Bitmap anyway.
>
> Or is the CF runtime doing something that is not normal?
>
> I always thought that when you enter a routine, local variables are
> created, and then when the routine loses scope, and you are returned
> to the calling routine, the local variables are destroyed.
>
> Doesn't the CF runtime work this way?
>
> -SS
>
> On Sat, 31 Jan 2004 14:57:13 -0500, "Alex Yakhnin, MVP"
> <a.yakhnin@online.att.net> wrote:
>
> >And also make sure that the file actually exists:
> >
> >If File.Exists(strPath) Then
> > /'bla, bla bla
> >End if
>



Relevant Pages

  • Re: buggy activity in compact .net app
    ... As for using .Disposeon the bitmap object ... ... I always thought that when you enter a routine, local variables are ... > /'bla, bla bla ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: buggy activity in compact .net app
    ... Actually the whole point of doing what I suggested was to make sure bitmap ... data is freed from memory *before* the next one is loaded. ... >> usefull either because the bitmap is created inside a routine. ... the local variables are destroyed. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: How to get an associated file icon without the Alpha Channel i
    ... no reason for keeping it around after the end of the routine anyway, just make the OLE picture object own the handle and there's no ... You don't need to select the colour bitmap into the temporary DC, GetDIBitsjust requires a device context handle rather than ... Rather than filling out the header structure yourself, you can use GetDIBits() to do this for you - have a look at chapter 3 of the ... When you're editing the mask data, you're attempting to operate on it in the same way as the colour data by getting GetDIBitsto ...
    (microsoft.public.vb.winapi)
  • Re: Delphi Roadmap (by David I)
    ... The programloads a bitmap, and applies a gaussian blur to it. ... image was 4105x3182 pixels. ... Under win32, my gaussian blur routine uses 3.0-3.1 seconds per run, ... Without copying to and from this buffer, ...
    (borland.public.delphi.non-technical)
  • Re: Nobody likes BASICdraw
    ... It has received the worst ratings of any recent graphics program on ... Not a single person has posted a routine for it. ... bitmap (arbitrary shapes, or operations using a masking bitmap ... Nowadays, images can be huge. ...
    (comp.programming)