Memory consumption by CHtmlView MDI windows - html

I have found a problem with the MFC CHtmlView class in an MDI app. Repeatedly opening and closing windows causes a progressive drain on memory. I’ve researched the problem and found the MSDN article about the BSTR problem (http://support.microsoft.com/kb/241750), implemented those fixes, but there is still a large drain occurring.
I’ve identified the problem in both VC8 and VC9, have tried to assure that all interfaces are truly being released, but am totally stumped.
The easiest way to see this is to use the MFC AppWizard (vc8 or vc9) to create a standard MDI app, only change the default CView to a CHtmlView. Compile and run the app in debug, and the app will automatically open a new html window to MSDN.
Open the TaskManager to follow the memory used by the app. Close the open window. Then each time you reopen and close a new window you’ll see a definite increase in the memory being held by the app. Once the app is closed though it show no leaks.
If anyone has any information, I'd appreciate hearing from you.

You can use SetProcessWorkingSetSize(pi.hProcess, (SIZE_T)-1, (SIZE_T)-1)) to minimize process working set.
http://msdn.microsoft.com/en-us/library/ms686234(VS.85).aspx
http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/88c21427-e765-46e8-833d-6021ef79e0c8

Related

Error creating WebGL context. Three js chrome?

Hi I'm getting the error
Error creating WebGL context.
Uncaught TypeError: Cannot read property 'getExtension' of null
This is happening on google chrome 71 but I find it odd because if I open up dev tool and refresh the page it works perfectly fine I'm at a loss to what is causing this any idea's ?
It's worked perfectly fine untill today nothing has changed on the PC or browser. My drivers are all up to date, webgl is enabled...
if you have two GPU installed on your system you might want to try to enable
Override software rendering list
in chrome://flags/
I'll leave this here for anyone else apparently it's a browser and graphic card issue
mrdoob: The graphics card is only one of the reasons why the context
can't be created
https://github.com/mrdoob/three.js/issues/4927
This seems to be why unless anyone else has any other ideas...
The issue is on going and not fixed it would be interesting to know why this happens though and why opening dev tools and refreshing resolves the issue for me.
EDIT-
Apparently for me this was due to my graphic card being blacklisted because it's old.
The fix for me was manually enabling WebGL acceleration under Chrome’s feature flags: chrome://flags/
I have encountered this several times with THREE.js. It arises for me once memory resources are shared, abandoned, or overwhelmed, for example:
I have a good render loop but then I introduce long tasks.
I perform extensive, continuous testing. As I modify live settings in Chrome Inspector, THREE does not reflect all changes without fail. Memory may not be released until I restart.
I leave the program running overnight. The next morning the browser is froze, black, OOM...
I use multiple instances of a resource, for example
Web Audio and Magenta Music. The quality may perceptibly degrade and
throw its own errors, but... I will also encounter worse silent
errors. For example when I also steam music in another tab, or click
audio/video media on Twitter... frozen browser, black screen, WebGL
context loss.
I just wanted to comment that I saw this due to other unrelated errors in my app that got thrown first.
I updated my graphic drivers (NVIDIA) and didn't restart chrome nor the PC, and was having this issue.
I just restarted the PC and now it's fine.
This was resolved for me by simply installing the latest and restarting my browser - thought I'd add it here to hopefully save some future soul from wasting an hour like i did.
Error creating webGL Context in three.js.min ver 93
I had the same problem with Chrome version 104.5112.102 and managed to fix it by going to Chrome, Settings, and switching off the
Use hardware acceleration when available.
the graphics card is an old GE Force 8600 card running on Windows 10.
For me, I restarted my computer and the error did not appear again. You can try doing this before you do anything more complicated.

DrawingSurfaceBackgroundGrid leaking memory in Windows Phone 8?

I'm working on an app using SharpDX to render DirectX content to a DrawingSurfaceBackgroundGrid in Windows Phone 8.
I've found that, if the app goes out to the photo picker or suspends/resumes through Fast Application Resume, memory utilization will increase by about ~2mb and prior resources will not be reclaimed. This means a DirectX-based app using DrawingSurfaceBackgroundGrid will eventually run out of memory on user-initiated actions.
The leak starts once DrawingSurfaceBackgroundGrid.SetBackgroundContentProvider is invoked with a SurfaceBackgroundContentProvider. I'm using a DrawingSurfaceBackgroundContentProviderNativeBase implementation that has empty method bodies for all abstract members.
An isolated repro can be found here. Repro steps are: build and run the app, click "choose photo", hit the hardware back button, observe memory spike.
Anyone else seeing similar?
This was a bug in SharpDX, which has been resolved in this commit.

Memory Issue in WP8 emulator?

My app is like a tweet feed reader. But with use, the app's responsiveness slows down in the wp8 emulator. By being unresponsive, I mean the progress bar indicator speed slows down, no links respond, none of the app buttons respond and the app suddenly closes.
I think it is a memory issue with the emulator. Am I right? I can't test it as I don't have a device yet.
Even on increasing the memory using the Hyper-V settings I didn't observe much difference.
I have an in-app browser which works fine for the first 2-3 links but then makes the app hang!
This doesn't sound like a memory leak. What you're describing is a slow-down which is caused by putting too much work on the UI thread. Overall you should offload as much work as possible to a background thread or the compositor thread.
The app suddenly closes sounds like some unhandled exception, but it's hard to tell which one. You said the app works fine on WP7. Have you looked at known app compatability issues that occur once WP7 apps are upgraded to WP8? Check it out on MSDN # http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206947(v=vs.105).aspx
This really isn't enough to go on. Is there something printed out in the output window once the app crashes? Can you tell what's the last managed method to be invoked before the app crashes? Can you try profiling the app for CPU and see what's the method that's most invoked? And profile for memory usage and see how's memory consumption right before the crash?

How does Battlelog launch games from browser?

Battlelog was released by EA alongside Battlefield 3 recently, and I'm curious how it is able to launch games, such as Battlefield 3, from a web browser?
More generally, how does a website launch programs locally?
I'm one of the developer responsible for the launch part of Battlelog. It's handled by a combination of the installed web browser plugin and JavaScript. Launching the game basically goes through these steps.
We figure out where you've installed the BF3.exe by using a registry key
We use the plugin to launch that exe with a couple of command line options
When the game client has launched, it opens a connection back to the plugin, for two-way communication between Battlelog and the game.
Game client sends state info and error messages back through the connection, so we can show progress and errors in Battlelog, and also know when the game has closed down.
It is thanks to the plugin you installed at battlelog. Websites are not allowed to execute programs on your local machine due to the HUGE security risk that would present. Plugins have to be used if you want to accomplish virtually anything outside the context of the browser, which is why you have to explicitly give them permission to install when they try to run.
I think that there are two options. First, the link points to a file which has an extension understandable only to that program, like when you click a .pdf link a pdf viewer will open. My second guess is that the link may use another protocol associated to the program in question, does the link start really with http://?
Im almost 100% sure it uses the plugin you have to install to manage the launch process as it also controls whether the game is minimised or not.

VS2008 partially freezing when switching to HTML design view

This is an odd freeze. When I switch from source view to design view for an HTML or ASPX file, the client area freezes, but I can still click on other tabs and menus.
What am I missing here? Really don't feel like reinstalling VS2008.
I had the same problem, and found one resolution.
In VS 2008, In a page that was using a master page, the either frequency while working in source view or switching to design view, IDE would freeze for 10-20 seconds.
In my master template, I had references to the Google hosted JQuery, Jquery UI, and one or two more scripts off site. These were placed directly in my master page's head section.
I downloaded the js and then by deleting any offsite references, my IDE would be smooth again in both design and source mode.
I also discovered I could put the scripts inside my ToolkitScriptManager (I'm using AjaxControlToolkit) and added the Mode="Release", and could place the http://www.google.com references for the scripts. The IDE is still working fine for me.
This is often due to the Design mode downloading external resources that are timing out. As #JonK mentioned, for him it was jQuery references. I have seen this when the ConnectionString was set to production databases that could not be accessed on my development machine, even though I wasn't debugging (running) the site only editing code, it would still try to connect and because it couldn't it would stall waiting for the timeout.
VS2008 is mostly single-threaded for UI operations like this, so if it is downloading a slow or non-existent network path it hangs like this.
VS2008 can make all kinds of network requests, so these two examples may not solve it for you. The best way I have found to diagnose the problem is to use the Microsoft tool Process Monitor, filter by the Process webdev.exe, and watch for I/O requests that are long running and/or throwing errors. In my case, I could find the place that was having a problem because there would be a 20 second gap in between the hundreds of I/O entries in Process Monitor. Then, just back-tracked from when that gap began and I eventually found the request that was causing the problem.
This may not be possible for you, but if you can, an upgrade to VS2010 would help; it does a much better job of running process on multiple threads in more places so you don't have to worry about this as much.
Have you tried restarting your computer and then reopening your project?