Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7182595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:48:11+00:00 2026-05-28T17:48:11+00:00

I am having fun creating my own wallpaper changer program. I know there are

  • 0

I am having fun creating my own wallpaper changer program. I know there are plenty on the internet, but i am simply trying to learn new stuff. So, till now, every time i was creating any simple program, i didn’t care about RAM/Memory cuz i was mostly creating programs for school, and it was like one time use program, and then i was forgetting about it.

But now i am trying to create application i would like to use, something mine. I noticed my program takes around ~4000k in “alt + ctrl + del” window, and it takes sometimes up to 200,000k when it changes wallpaper, and sometimes goes down, and sometimes stays that high till it changes it to another one.
Memorytaken

So here comes the question, what are tips to make my app use least possible ram while running (tray icon, and main windows is hidden using if (FormWindowState.Minimized == WindowState) Hide();)

Is variable inside a function taking any memory? Example

int function(int a){ 
int b = 0;
int c = a+b;
return c;
}

Or are these variables released after function returns some value?

I could use some tips, guides, and/or links to articles where i could get some info about that. Newbie friendly tho.

EDIT:
Okay, i have read some, started to dispose bitmaps, got rid of one of my global variables i was using.. and its on steady 4000-7000k now. Raising a little when changing wallpaper, but then lowering back to that. So i guess thats kind of success for me. One more thing left. I downloaded kinda big/large/with many options program, that changes wallpapers, and it got a loot more options than mine, and still it takes around 1000-2000k, so ima read now what can take so “much” ram in mine. Right when i run my program its about 4100, so i guess i still can do something to optimize that. Thanks everyone for answers tho! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:48:12+00:00Added an answer on May 28, 2026 at 5:48 pm

    Memory from your program’s perspective is divided in two blocks if you will. The Stack and the Heap.

    The Stack represents the current frame of execution (for instance the currently executing function), and it is used to pass function parameters, return values and is where local variables are generally stored. That memory is purged when the the current frame of execution ends (for example your function exiting).

    The Heap represents a memory pool where objects can be created and stored for longer periods of time. Generally, anything created using the “new” operator will go on the Heap, with the references existing on the Stack (for local context). If references to the allocated object stop being used, that memory remains taken until the Garbage Collector runs at some unspecified time in the future and frees the memory. When the GC runs can not be guaranteed – it might be when your program is running out of memory, or at scheduled intervals etc.

    I think in the memory behaviour you are observing, spikes are due to opening up and loading resources, troughs are after the GC runs. Another way to observe this is to look at a program’s memory footprint when there is UI showing on the screen, and when the program is minimized. When minimized the memory footprint will shrink, because all the graphical elements are no longer necessary. When you maximize the UI and redraw it, memory usage peaks.

    You can look at the following articles for a better understanding of Stack and Heap:

    C# Stack and Heap

    What are stack and heap?

    You might also want to look into Garbage Collection:

    Garbage collection article on MSDN

    … and Value vs Reference types

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm an amateur, admittedly so, but I'm having fun trying to learn a little
I am somewhat new to jQuery but have been having fun trying learn about
I'm currently having fun trying to learn some of the Boost libary. I'm currently
I know this is strange but I'm just having fun. I am attempting to
I'm having some fun trying to get my head around some MVP stuf, as
I am playing around with validating form inputs. For now I'm simply having fun
I have connected Oracle to Access, and I have been having fun creating pivot
I am beginning some experimentation in writing a kernel and having fun doing it.
We're having a bit of fun here at work. It all started with one
so I'm having a lot of fun with Perl at home for some time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.