dcsimg
Results 1 to 7 of 7

Thread: app crash, memory problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    193

    app crash, memory problem

    I have this app which monitors the temperature of my cpu. I also placed memory cleaning garbage collector everytime the function finishes cause I noticed an increasing usage of cpu memory.

    However, after how many hours like 3 hours, the app crashes stating memory problem.

    How do I resolve this memory problem properly ?

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,811

    Re: app crash, memory problem

    Quote Originally Posted by genlight View Post
    I noticed an increasing usage of cpu memory.
    I doubt that. The only sensible definition for "CPU memory" would be cache but you're almost certainly talking about RAM, which is just general memory and nothing to do with the CPU. An increase in RAM usage isn't necessarily an issue, because that's a measurement of memory that has been allocated, not what is being actively used. It is less onerous for new memory to be allocated when an application needs it rather than reusing memory that was previously allocated and may no longer be needed. The memory no longer being actively used is cleaned up later, e.g. when a form is minimised. That said, it sounds like the memory allocated to your app isn't being reclaimed at all, or at least sufficiently. That may be because your app isn't properly flagging it as unused or it may because your app is always too active for GC to occur.
    Quote Originally Posted by genlight View Post
    However, after how many hours like 3 hours, the app crashes stating memory problem.

    How do I resolve this memory problem properly ?
    There's just no way that we can answer that because the reason will be specific to your code. We'd need to know far more detail about what your code is doing and how. In general though, be sure to dispose any objects that support it once you're finished with them and ensure that your code doesn't hold references to objects (particularly large object, e.g. Images) longer than it needs to. If you're actually calling GC.Collect and you're still seeing memory usage go beyond what it should, my first guess would have to be that you're not doing the latter and possibly not the former either.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    193

    Re: app crash, memory problem

    this is in relation to my previous post about making an icon for my systray icon where the icon comes from a temperature text value.

    yes I have objects and I properly dispose() them after using them and at the end of the code, I also gc.collect. I can see that the memory it is using in KB is 1700 to 3000 and goes back to 1700 after gc.collect has been executed. but even so, at some time, the app crash.

    The memory I mentioned that was increasing was on the commitsize and paged pool. Like my commitsize is from 32000 and increasing by 1.
    The paged pool is from 300 and increasing by 1 perhaps every 20 seconds. I am not sure though what this paged pool and commit size is all about found on taskmanager, processes tab.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,811

    Re: app crash, memory problem

    What is the exact error message? That is always relevant.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    193

    Re: app crash, memory problem

    i will post back if i see that exact error message again

    UPDATE: ATTACHED BELOW ARE MY APP CRASH SCREENSHOTS
    Attached Images Attached Images   
    Last edited by genlight; Feb 2nd, 2018 at 07:24 AM.

  6. #6
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: app crash, memory problem

    This is the only forum I use where attached images are intentionally resized to be completely illegible.

    What few numbers I see look trivial. That's not "runaway memory usage". I can't read what the error says but it doesn't even look like it has words that imply memory usage?

    Calling the garbage collector manually rarely fixes things. At best, you usually slow your program down. At worst, you slow it down A LOT. If you aren't having a "sawtooth" pattern of memory usage, where it steadily increases then drops as GC passes happen, then odds are you are leaking unmanaged memory. That memory doesn't belong to the GC, so no matter how hard you try you can't get the GC to collect it.

    If you're monitoring your CPU temperature, you're likely using something unmanaged to do so even if you don't realize it. We can't talk about your memory usage if we can't see your code. Maybe you're right, and you are cleaning up after yourself. We'll be the judge of that. It could be that the thing you're using has a memory leak: in that case it's not your fault and they have to fix it.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    193

    what causes this appcrash ?

    Please see attachment.

    I wanted to know what does the exception code and offset means on this appcrash info.
    Attached Images Attached Images  
    Last edited by Shaggy Hiker; Feb 22nd, 2018 at 11:26 AM. Reason: Cleaned up after merging.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width