Technology Questions

Go Back   Technology Questions > Hardware Questions > Electronics > Pocket PC General

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 02-15-2008, 04:21 AM
sid
Newsgroup Contributor
 
Posts: n/a
Garbage Collector Trauma

Hi

I have an application written in VB.NET for windows mobile 2005
device. In addition I have 2 unmanaged DLL's written in C which the VB
app uses.

The app runs absolutely fine until the system garbage collector gets
triggered, at which point one of my DLL's (in which I create a
separate thread for some sound recording task) thread gets suspended
and never gets up after that. At this point my application just stops
working.

Is there any way I can mark my THREAD as GC-SAFE so that GC just
bypasses it during its sweep operations.

The intriguiing part is, if I manually trigger the GC with the
following lines (executing these lines quite regularly)

GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()

then it seems to be working fine, even when the GC is virtually always
on.

Anyone has any say on this please advise as I am not convinced with
calling the GC commands from within the application.

Cheers
Sid
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 02-15-2008, 04:21 AM
  #2 (permalink)  
Old 02-15-2008, 05:50 AM
Newsgroup Contributor
 
Posts: n/a
Re: Garbage Collector Trauma

Are you saying a thread in the *native* DLL is getting suspended? If so
then that's not possible as the GC knows nothing about the threads and
cannot and will not affect them. THis sounds a lot more like a pinning
problem to me. Like your native thread is using some data from the managed
app and when GC happens that managed data is getting moved during a
compaction (which doesn't happen with every GC and would explain why it
doesn't happen when you manually call collect). With what little info we
have so far, my bet is you're passing in a variable that is getting used in
the native DLL - probably being sent by reference - that you're not pinning.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com




"sid" <mailsid******.com> wrote in message
news:25261b1a-081c-4e1a-aefc-43eb9ef4373e@d4g2000prg.googlegroups.com...
> Hi
>
> I have an application written in VB.NET for windows mobile 2005
> device. In addition I have 2 unmanaged DLL's written in C which the VB
> app uses.
>
> The app runs absolutely fine until the system garbage collector gets
> triggered, at which point one of my DLL's (in which I create a
> separate thread for some sound recording task) thread gets suspended
> and never gets up after that. At this point my application just stops
> working.
>
> Is there any way I can mark my THREAD as GC-SAFE so that GC just
> bypasses it during its sweep operations.
>
> The intriguiing part is, if I manually trigger the GC with the
> following lines (executing these lines quite regularly)
>
> GC.Collect()
> GC.WaitForPendingFinalizers()
> GC.Collect()
>
> then it seems to be working fine, even when the GC is virtually always
> on.
>
> Anyone has any say on this please advise as I am not convinced with
> calling the GC commands from within the application.
>
> Cheers
> Sid



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 02-15-2008, 07:10 AM
sid
Newsgroup Contributor
 
Posts: n/a
Re: Garbage Collector Trauma

On 15 Feb, 13:43, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
> Are you saying a thread in the *native* DLL is getting suspended? *If so
> then that's not possible as the GC knows nothing about the threads and
> cannot and will not affect them. *THis sounds a lot more like a pinning
> problem to me. *Like your native thread is using some data from the managed
> app and when GC happens that managed data is getting moved during a
> compaction (which doesn't happen with every GC and would explain why it
> doesn't happen when you manually call collect). *With what little info we
> have so far, my bet is you're passing in a variable that is getting used in
> the native DLL - probably being sent by reference - that you're not pinning.
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded communityhttp://community.OpenNETCF.com
>
> "sid" <mail...******.com> wrote in message
>
> news:25261b1a-081c-4e1a-aefc-43eb9ef4373e@d4g2000prg.googlegroups.com...
>
>
>
> > Hi

>
> > I have an application written in VB.NET for windows mobile 2005
> > device. In addition I have 2 unmanaged DLL's written in C which the VB
> > app uses.

>
> > The app runs absolutely fine until the system garbage collector gets
> > triggered, at which point one of my DLL's (in which I create a
> > separate thread for some sound recording task) thread gets suspended
> > and never gets up after that. At this point my application just stops
> > working.

>
> > Is there any way I can mark my THREAD as GC-SAFE so that GC just
> > bypasses it during its sweep operations.

>
> > The intriguiing part is, if I manually trigger the GC with the
> > following lines (executing these lines quite regularly)

>
> > GC.Collect()
> > GC.WaitForPendingFinalizers()
> > GC.Collect()

>
> > then it seems to be working fine, even when the GC is virtually always
> > on.

>
> > Anyone has any say on this please advise as I am not convinced with
> > calling the GC commands from within the application.

>
> > Cheers
> > Sid- Hide quoted text -

>
> - Show quoted text -


Yes I am sending a few variables from the VB.NET to the C-DLL through
DLL function calls. But all of them seem to be going ByVal. Are
strings sent ByRef even if you send it ByVal. There are only two
variables I send ByRef, but I suspect the problem is with them. I am
still in the process of checking it..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OutLook 2007 is Garbage or What? clintonG Microsoft Office 4 02-14-2008 11:20 AM
Why does it print garbage when using 'envelopes'? lcrouch Microsoft Office 1 07-26-2007 08:50 AM
C:\Windows\Temp garbage files? MrBill Windows Vista 19 07-14-2007 03:40 AM
Email Garbage MasCur Internet Explorer 4 05-06-2007 09:44 AM
LOST MY GARBAGE ICON!!! lol MeTRulez Windows Vista 2 02-04-2007 09:45 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 08:21 AM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0