Freeing memory in QML after loading images - qt

I'm new in using QtQuick apps, I wanted to ask about memory management, how can I free memory after loading images using Image item using QML ?

Memory management in QML is automatic. You are not supposed to do anything.
However, forcing JavaScript's garbage collection might sometimes help free some memory, as I myself have found the JS engine to be rather liberal with memory usage. You can do that by invoking gc()

Related

How to reduce memory consumption of a Qt program with CSS codes?

I am using Qt framework to develop a software to drive a robot arm. The program is working fine but it consumes a lot of memory( 2 - 3 Gb of RAM). I have fixed a memory leak but still problem is there.
I am using many CSS codes to modify graphical aspects of widgets. I noticed that CSS code consumes a lot of available memory.
Have you ever had this problem ?
Have you any idea to reduce memory usage?
Thanks

Diagnose a RAM usage spike on page load

When we launch our game in the AirConsole, the RAM usage jumps really high and we get an "Out of memory" error. The only way to actually test the game is to upload a Development build with exceptions enabled and the WebGL Memory Size set to 2047. That's the only scenario, when the game doesn't crash.
We used Chrome to monitor the RAM. When we launch the game in the AirConsole, the RAM gets heavily loaded (2 GB or so) and after the game loads, the RAM usage becomes much lower (about 1 GB).
I think it is directly connected to the huge JS file that we get, when we make a WebGL build, but that's only a guess.
How can we diagnose the problem and lower the RAM usage?
Well, you need to profile memory usage by the page with the tools a browser provides - just like you would do for a desktop application.
JavaScript Memory Profiling - Google Chrome
MemoryBug Firefox extension
Diagnosing memory problems in your webpages (Windows) - MSDN
They vary in sophistication, but are basically the same as in every other garbage-collected environment. They can be divided into two basic types:
rough data: general dynamics, snapshots (incl. on events), usage by entities (DOM,JS,plugins) - identify main hogs
fine data: GC statistics, object links - locate specific culprits

CPU Usage on File Upload with Telerik RadAsyncUpload

I'm having a huge CPU usage when two or more users are uploading files using RadAsyncUpload. We tried to limit the CPU usage at 20% at IIS, but it did'nt solved. One of the cons is that the upload speed sometimes is like 1Kbps :(
Try playing with the ChunkSize property to see if it will help http://www.telerik.com/help/aspnet-ajax/asyncupload-disable-chunk-upload.html
If large files are used, perhaps they go to the memory and this loads the server.
I have never heard of such a problem before, though.

Flex application scalability and compatibility

How good is a Flex app in handling large amount of data (say, for a reporting kind of application)
Are there any memory management issues that need to be kept in mind while developing for such an app
Are there any issues in running a Flex app on a Mac?
1) great as long as you're not transferring huge amounts of data at one time using HTTPService. A good AMF remoting like amfPHP runs super fast.
2) Flash player runs on the clients machine, you would need to make sure you aren't using more memory than they have available.
3) If I remember right flash player is kind of weak on the mac, much slower than PCs but I haven't bench-marked them in a while
Flex can use a lot of memory in a poorly written application. A well written application will manage it's assets well and will not use more memory than needed. Flex is wonderful for a reporting application since you can do data manipulation on the client and do a lot of client side analysis and re-presentation of data.
Profiling. Flex Builder has a decent memory profiler so make sure you use it and don't leave dangling references around. Event handlers can keep references you don't realize if you don't clean them up. States can also cause problems if they're used inappropriately--to manage the state of the whole application for example instead of in a small scale within individual application components.
Flex is slower on the mac. This is largely due to the limited api provided by browsers on the mac. On PC the Flash Player has access to GPU acceleration and other low level API's which can make it faster. This is going to get better when Flash Player 10.1 is released since it will take advantage of new core animation api's available in Safari 4 on OSX 10.6.

ASP.Net: Finding the cause of OutOfMemoryExpcetions

I trying to track down the cause of an OutOfMemory for a website. This site has ~12,000 .aspx pages and the last time it crashed I captured a memory dump using adplus.
After some investigation I found a lot of heap fragmentation, there are around 100MB of Free blocks which can't be assigned. Digging deeper one of the Large Object Heaps is fragmented and the causes seems to be String interning as described [here][1]
Could this be caused by the number of pages in the site? As they are all compiled they sit in memory and by looking at the dump they are interned and PINNED which I think means they stick around for a while.
I would find this odd as there are many sites with more pages, but dynamic compilation could account for the growth in memory.
What other methods are there for finding the cause of the memory leak? I have tried to capture a dump using adplus in hang mode but this fails and the IIS worker process get recycled.
[1]: • Large Object Heap Fragmentation
Yep fragmentation is one of the reason because it will be more difficult to 'find' memory.
Some very known clues :
On a 32bit OS, your worker process can't exceed 2 GB in memory even if your system have more. An alternative is the /3GB switch (boot.ini file).
The likelihood of experiencing an OutOfMemoryException begins to increase dramatically when “Process\Virtual Bytes” is within 600 MB of the virtual address space limit (generally 2 GB), and secondly, tests have shown that “Process\Virtual Bytes” is often larger than “Process\Private Bytes” by no more than 600 MB
The CLR is allocating and handling the memory by blocks (64 MB from memory;)). It does not mean it use all this memory, it means one block will not be freed until one byte is used and it's how the memory become fragmented.
When the CLR can't allocate memory (new block needed), and it can't garbage collect or page some of the memory, OutOfMemoryException is going to happen in the best case or the server will be overloaded in the worst case.
About dynamic compilation, that's true but the most important is the <compilation debug="false" /> / <deployment retail=”true”/> switches. They turn on batch compilation which mean one DLL by directory (this is another point) and not one DLL per 'page' which cause virtual space fragmentation.
About one DLL by directory, even with batch compilation, more directories/sub-directories you have, more DLL you will have and more fragmented virtual address space you will have.
Personally, I use ANTS Memory Profiler to find memory issues.
There is a really good blog here by Tess Ferrandez that talks about memory issues and other types of debugging issues while developing ASP.NET applications.
One post in particular walks you through a tutorial to see if you have a leak. Its uses the nasty WinDBG, but she explains all the commands so you can get a clear picture of your used memory and it shows you exactly which objects are filling all the space.
I have used her site many times to diagnose memory leaks and other performance related problems.
I have also used tools like DebugDiag to help capture memory related issues and used its built in diagnostic tools to help find the problems.

Resources