Qt MSVC 2015 Compiler Are Used All Memory Of My System
-
My Qt Version Is : 5.12.3
Details : When I Build My Qt Program That Time It Will Used All Memory Of My System
-
@Ketan__Patel__0011
We don't know how much memory you have, we don't know how much of it is free, we don't know whether you get an error message, we don't know how big your code is. So what sort of answer are you expecting? -
Hi
How much memory do you have?
8 GB is a minimum for a dev station running win 10. -
@Ketan__Patel__0011 Why do you think this is bad? RAM is there to be used. The compiler uses as much RAM as is available. As long as the RAM is released after compilation I don't see how this is an issue.
-
@jsulm said in Qt MSVC 2015 Compiler Are Used All Memory Of My System:
The compiler uses as much RAM as is available. As long as the RAM is released after compilation I don't see how this is an issue.
Try attempting to start up e.g. Word while compilation is running and using all RAM if you don't think this is an issue! :) All processes should have the amount of RAM they can help themselves to limitable. I'm not saying this has any particular relevance to OP's situation. And anyway this looks like an MSVC issue, not Qt. I used MSVC for years and can't say I ever noticed it taking all RAM, even on large projects.
-
@Ketan__Patel__0011 said in Qt MSVC 2015 Compiler Are Used All Memory Of My System:
Details : When I Build My Qt Program That Time It Will Used All Memory Of My System
You need to give more details about your program. Ironically I have the same problem with gcc currently, but it's my own fault - I have an unending recursion in template instantiation which I need to fix.
-
You Can See When I Start The Build It will taking More Then 3GB RAM
And Still Project Build is Not Complete -
@Ketan__Patel__0011
Hi
So you have 4 GB mem in all ?Did the project used to compile before ?
Did you add some huge bitmaps lately or anything like that ?
-
@JonB So, you think the compiler should not use all available free RAM? How much should it use? It is the responsibility of the OS to distribute RAM across all running processes. If you start some other application while compiling OS should handle that. On my machine I can use other applications while compiling a big project without issues (Linux).
-
@jsulm
I think something like a compiler, which could use a large amount of memory probably in cache buffers, has (ought to have) a responsibility to allow itself to be limited to a certain amount, so that other processes have a chance to use some free RAM, yes.[I note that there are quite a few posts out there on the web from people asking how to limit, say,
gcc
memory usage because of "running out of space" issues. Just saying. Looks like I'm over optimistic about it having support for limiting its usage. Anyway, in real possibility for the OP, some talk about needing to limitmake -j<num>
, not because of threads/cores but because of RAM. I don't know if Qt Creator build usesmake [-j]
.]If I didn't care about other processes I wouldn't necessarily bother to free program objects as I went along, I could leave it just using them until program exit [assume my own program does run out of memory itself] and tell the user/OS to find some other free memory, or I could choose algorithms which use much memory. But I'm a good OS citizen, so I do free as I go along, and even though it might suit me to hold everything in memory for just my program I do use files where appropriate instead, etc.
The OP is under Windows. Windows does not offer the same memory management governance as Linux. In practice I haven't seen a working
setrlimit
under Windows. I wasn't so much saying about using another program --- which may already be in memory --- I was saying about trying to start another program, which can in practice be blocked by no free RAM.Having said that, I have watched my Linux box (VM under Windows) where a process has taken up all RAM, then swap space. It is not a pretty sight. Hard reboot required from frozen machine. Should it happen under Linux that it gets to this state? Probably not. But it does. Have you tested system behaviour if you write a program which keeps allocating memory till all physical + swap space is used up, and then try to go off and do other things, including interacting with the desktop?
So perhaps your experiences differ from mine.
-
@Ketan__Patel__0011
can you upload that project so we could try ourself? -
@JonB Sorry, I still do not see why compiler should limit itself. If there is free RAM it can be used. If some other application needs RAM OS will handle that. Maybe Windows is not that good at that (I don't develop on Windows), but on Linux I would not want to limit RAM usage for the compiler without a reason.
-
@jsulm
May I just ask how you find your OS/machine behaves if you write a program which continues allocating memory till no free memory and no swap space left? My Ubuntu simply freezes/dies. This is purely OOI, I'd like to hear.Meanwhile, since these compilers do not offer to limit memory themselves, I accept that is how it is. In the OP's case it may be moot, as it does not look like his 4GB is enough to accommodate Creator/compilation on his project either at all or comfortably.
-
@Ketan__Patel__0011 said in Qt MSVC 2015 Compiler Are Used All Memory Of My System:
Sorry I Can't Upload My Whole Project
Create a minimal project that replicates the issue. You will probably find a solution while doing this.
-
@JonB said in Qt MSVC 2015 Compiler Are Used All Memory Of My System:
if you write a program which continues allocating memory till no free memory and no swap space left?
This is not how the compiler behaves. It uses available memory. I never had freezes while compiling. The system can get a bit laggy sometimes, but that's all.