How to reduce memory usage when creating windows metro applications? - windows-runtime

I created a metro style app or windows 8,but on using that app my CPU memory usage is always going high,not a single byte is reduced after started running.I think this s because of not properly handling memory.Any body have suggestions for effective handling memory?

I think windows rt handles memory on its own ... so no garbage collection or releasing.
I have a pretty memory intensive app and I find that the following really impacts memory:
lots of ui elements in XAML files
large predefined arrays (e.g., string[,] arr = new string[100,100])
not using incremental loading and ItemsControl
If you provide more info about what your app contains/does the community can help you a bit more.

Related

Direct3D texture resource life cycle

I have been working on a project with Direct3D on Windows Phone. It is just a simple game with 2d graphics, and I make use of DirectXTK for helping me out with sprites.
Recently , I have come across to an out of memory error while I was debugging on 512mb emulator. This error was not common and was the result of a sequence of open, suspend , open , suspend ...
Tracking it down, I found out that the textures are loaded on every activation of the app, and finally filling up the allowed memory. To solve it , I will probably go and edit it so as to load textures only on opening but activation from suspends; but after this problem I am curious about the correct life cycle management of texture resources. While searching I have came across to Automatic (or "managed" by microsoft) Texture Management http://msdn.microsoft.com/en-us/library/windows/desktop/bb172341(v=vs.85).aspx . which can probably help out with some management of the textures in video memory.
However, I also would like to know other methods since I couldnt figure out a good way to incorporate managed textures into my code.
My best is to call the Release method of ID3D11ShaderResourceView pointers I store in destructors to prevent filling up the memory , but how do I ensure textures are resting in memory while other apps would want to use it(the memory)?
Windows phone uses Direct3D 11 which 'virtualizes' the GPU memory. Essentially every texture is 'managed'. If you want a detailed description of this, see "Why Your Windows Game Won't Run In 2,147,352,576 Bytes?". The link you provided is Direct3D 9 era for Windows XP XPDM, not any Direct3D 11 capable platform.
It sounds like the key problem is that your application is leaking resources or has too large a working set. You should enable the debug device and first make sure you have cleaned up everything as you expected. You may also want to check that you are following the recommendations for launching/resuming on MSDN. Also keep in mind that Direct3D 11 uses 'deferred destruction' of resources so just because you've called Release everywhere doesn't mean that all the resources are actually gone... To force a full destruction, you need to use Flush.
With Windows phone 8.1 and Direct3D 11.2, there is a specific Trim functionality you can use to reduce an app's memory footprint, but I don't think that's actually your issue.

Griffon applications - memory usage

I have a question referring to Griffon.
Is there a way to decrease memory consumption of griffon applications?
Actually the sample griffon application process (just single window with
label) takes in Windows ~80MB. Is there a way to change something to
visibly decrease this basic memory usage?
Griffon is a great solution etc. but my customer complains that a simple
application takes such an amount of memory (more than e.g. Word, Outlook,
or most of complicated Java application - comparable with whole).
A barebones Griffon app (just by calling create-app and nothing more) reports 49M of memory usage. In terms of file size it's a bit above 7M. Whereas a java base Griffon app (griffon create-app sample --file-type=java) rises up to 42M of memory usage; same file size.
This is of course using default settings provided by the run-app command. Further memory configuration settings may be applied to limit and streamline resource consumption.

AIR mobile runtime memory leak?

I have an app developed with AIR 3.7 for iOS (iPad)
The app gets very sluggish after a while, eventually crashes.
I've been -very- careful to pool objects where possible and cleanup / nullify all objects once they're not needed any more.
Profiling the app in Scout returns a pretty stable memory profile (the peaks and the lows translate very well to what's happening on screen)
Simultenously profiling the app using XCode's Instruments, shows me that the apps memory consumption constantly rises up to the point the systems spends more time throwing memory warnings than anything else.
Here are screenshots of both profilers: they show AS3 memory usage being pretty stable. On the app level though, memory consumption keeps rising...
https://dl.dropboxusercontent.com/u/608333/AIR_memory_leak.zip
If AS3 is not leaking any memory (according to scout), but the app is (according to Instruments), would I be right assuming there's a memory leak in the AIR-runtime itself?
thanks for your feedback!
bart.

Understanding 'Native Memory profiling' in Chrome developer tools

I am building an application with a simple search panel with few search attributes and a result panel. In the result panel, I am rendering the data in a tabular form using Slickgrid.
After few searches (AJAX call to server), the page gets so much loaded and it eventually crashes after sometime. I have checked the DOM count and the JavaScript heap usage for possible memory leaks. I couldn't find anything wrong there. However, when I ran the experimental native memory profiler, I see that the "JavaScript external resource" section uses 600+ MB memory. On running the garbage collector, it is getting down to few MBs. I have couple of questions here:
What contributes to the "JavaScript external resource" section? I thought it corresponds to the JSON data / JavaScript sources which gets transferred from the server. FYI, the gzipped JSON response from the server is ~1MB.
Why is Chrome not releasing the memory pro-actively instead of crashing the page? Again, when I manually run the garbage collector, it is releasing the memory used by "JavaScript external resources".
How do I fix the original problem?
JS Heap Profiler makes a snapshot of the objects in the javascript but javascript code may use native memory with help of "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array" and "Float64Array".
So when you take a snapshot it will have only small wrappers that point to native memory blocks.
Unfortunately heap snapshot does not provide data about the native memory that was used for these kind of objects.
Native heap snapshot is able to count that memory and now we know that the page uses native memory via an array or via an external string.
I'd like to know how did you check that the page has no memory leaks? Did you use three snapshot technique or just checked particular objects?
Tool to track down JavaScript memory leak

What contributes to 'Other' section in Native memory snapshot in Chrome developer tools?

As I load more data into my application, 'Other' section keeps growing in my web app. What does this mean? I have checked my code for any memory leaks and couldn't find any. Also, the objects I hold in my application are very much needed for the application.
Varunkumar Nagarajan
How do you checking your app for a leak?
Have you seen Tool to track down JavaScript memory leak
Native memory snapshot is an experimental feature and couldn't be used for detecting memory leaks at the moment.