RAM usage indicator and RAM "loading" sign on the Celestia screen?

Description: Discussion forum for Celestia developers; topics may only be started by members of the developers group, but anyone can post replies.

Topic author
Topic author
Posts: 107
With us: 5 months 12 days

#1by john71 » 10.01.2017, 17:47

In my experience Celestia often crashes between 1500MB and 2000MB RAM usage on Windows.

It would be nice to have a "Loading..." sign on the screen during the RAM loading, because the screen often freezes during loading large textures or models.

Also the actual RAM usage should be on the screen too, it would be a nice way to know the limits of Celestia before it crashes...

Posts: 23
With us: 5 months 9 days

#2by Janus » 10.01.2017, 19:38

I have tracked memory usage in the past, not on celestia, bit on other projects, and it is not all that hard.
However, the calls are expensive timewise, so calling them every frame will affect performance.

I was working on pascal, which I prefer to C/C++, and what I did was add a memory variable to my main loop object, along with a time marker.
Then as it looped it would check the current time, and if enough had passed, it would update the memory information to be displayed.
Partially copied from an MS article. <https://msdn.microsoft.com/en-us/library/windows/desktop/ms682050%28v=vs.85%29.aspx>

The same could be done here by adding

PROCESS_MEMORY_COUNTERS & UpdateTime variables.
Maybe add hProcess as well.

Then in celestiacore.cpp inside celestiacore:renderoverlay() where the time is displayed.

Code: Select all

hProcess here is celestia process ID.

//This means only compile this in if windows, not sure how to do this myself.
// I am not a real C/C++ programmer, but there are plenty of them on here who can translate this.
if (Windows)
    if (UpdateTime - CurrentTime > 1 ) // Make this a one or two second delay between updates.
        GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc))
    printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount );
    printf( "\tPeakWorkingSetSize: 0x%08X\n",
              pmc.PeakWorkingSetSize );
    printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize );
    printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n",
              pmc.QuotaPeakPagedPoolUsage );
    printf( "\tQuotaPagedPoolUsage: 0x%08X\n",
              pmc.QuotaPagedPoolUsage );
    printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n",
              pmc.QuotaPeakNonPagedPoolUsage );
    printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n",
              pmc.QuotaNonPagedPoolUsage );
     printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage );
     printf( "\tPeakPagefileUsage: 0x%08X\n",
               pmc.PeakPagefileUsage );

Not hard, just messy.
Could even be added to the menus if this is useful enough to others.

P.S. I know I got the case on some things wrong, sorry, but case sensitive variables names are simply insane to me, and unusable, which is why I will never be a real C/C++ programmer, the languages are unhinged in my opinion.
I also know I am in the minority.

John Van Vliet
John Van Vliet
Posts: 2560
With us: 14 years 4 months

#3by John Van Vliet » 10.01.2017, 20:26

, but case sensitive variables names are simply insane to me,
but NOT me
nor any NON micro$hit user

Posts: 23
With us: 5 months 9 days

#4by Janus » 10.01.2017, 23:16

, but case sensitive variables names are simply insane to me,

but NOT me
nor any NON micro$hit user

I do not appreciate your tone.
This is also not the place to get into an M$ vs non M$ debate, and that is not the way to do so.
I am not a fan of M$, I simply find windows usable when properly configured.
I have heard the complaint about case sensitivity in variables and filenames from many people over the years, not all of whom were windows users.
Some of us do not use case in that way, and that is just the way life works.

I have tried macs, and I have tried several variants of Linux, though not all of them.
None of them work for me.
This is an individual thing, it depends on how you use a computer, and what you use it for.

Drive letters work for me very well, floating mount points do not.
Some people find them quite natural to work with, and I have no problem with that.
Individuals should use what works for them.

If your preference is for Linux, then please, use it.
Do not however, assume that anyone not like you is an idiot, or to be looked down upon.

I find the start menu and desktop used in win9x through win2k matches how I work very well.
The one in XP can switched back to a classic version, which I find easy to work with.

My preference for an OS will be ReactOS when it becomes stable enough to use everyday.
I am not however the type of programmer who works on that large of a project though.
If you are not familiar with it, it is an open source copy of windows.

If this is how you are going to interact on the forum, then please, feel free to ignore anything I happen to post on or about.


EDIT: Quoted comment to keep context so others can follow along if they so choose.

Return to “Ideas & News”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest