Re: buggy activity in compact .net app
From: Chris Tacke, eMVP (ctacke[at]Open_NET_CF[dot]org)
Date: 02/01/04
- Next message: Alex Feinman [MVP]: "Re: buggy activity in compact .net app"
- Previous message: Chris Tacke, eMVP: "Re: eVC4 DLL Interop Problem with double ????"
- In reply to: Sarah Smith: "Re: buggy activity in compact .net app"
- Next in thread: Alex Feinman [MVP]: "Re: buggy activity in compact .net app"
- Reply: Alex Feinman [MVP]: "Re: buggy activity in compact .net app"
- Messages sorted by: [ date ] [ thread ]
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
>
- Next message: Alex Feinman [MVP]: "Re: buggy activity in compact .net app"
- Previous message: Chris Tacke, eMVP: "Re: eVC4 DLL Interop Problem with double ????"
- In reply to: Sarah Smith: "Re: buggy activity in compact .net app"
- Next in thread: Alex Feinman [MVP]: "Re: buggy activity in compact .net app"
- Reply: Alex Feinman [MVP]: "Re: buggy activity in compact .net app"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|