Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Fix: Ribbon text displays inactive after migrating to VS2012 Pin
Richard MacCutchan25-Feb-13 21:49
mveRichard MacCutchan25-Feb-13 21:49 
QuestionMemory leak Pin
a_matseevsky25-Feb-13 9:19
a_matseevsky25-Feb-13 9:19 
AnswerRe: Memory leak Pin
Richard Andrew x6425-Feb-13 10:11
professionalRichard Andrew x6425-Feb-13 10:11 
GeneralRe: Memory leak Pin
a_matseevsky25-Feb-13 16:07
a_matseevsky25-Feb-13 16:07 
GeneralRe: Memory leak Pin
Stephen Hewitt25-Feb-13 16:43
Stephen Hewitt25-Feb-13 16:43 
GeneralRe: Memory leak Pin
Richard Andrew x6426-Feb-13 9:11
professionalRichard Andrew x6426-Feb-13 9:11 
AnswerRe: Memory leak Pin
David Crow25-Feb-13 13:24
David Crow25-Feb-13 13:24 
AnswerRe: Memory leak Pin
Stefan_Lang26-Feb-13 4:04
Stefan_Lang26-Feb-13 4:04 
A program using DLLs may delay loading them unto the point when they're first needed. This appears to have happened here. The problem with that is that the DLLs will then stay until you exit your program, or manually unload them (as suggested above).

Why CFileDialog loads all these DLLs isn't clear to me. My guess would be file preview settings - but then I would have thought the DLLs used for previewing would be loaded to system memory, not application memory. Anyway, this is not in fact a memory leak, "only" a shortage of memory.

Moreover, you should normally not even be able to notice memory fragmentation, except for the fact that the operators new and delete notably slow down when you're low on memory. The system memory manager hides the true physical memory addresses from you, and translates them to a virtual application memory address space. So even if you get addresses from allocations that indicate a state of fragmentation, this may be misleading.

That said, the memory manager will easily allocate huge blocks of memory for you even if fragmentation does split up your memory into unusably small chunks: it has the ability to pretend a contiguous block of memory, even if the physical memory is spread out all over the entire available physical memory space.

Your problem is a different one however: you cannot load a large file into memory as a whole. that means your application is using more memory than available. Note that even with 16 GB RAM, the memory space of an application is limited to no more than 4 GBm or in Windows in fact only about 2-3 GB, depending ont the OS version.

The solution is to split it up. It isn't a good idea to load such big files into memory anyway - exactly because of the problem you encountered. Depending on what you wish to do with that file, you don't need the full file at any point in time anyway. Instead use a buffer of at most a few MB in size, load a chunk, process the data, store the intermediary results, then repeat until you're done.
GeneralRe: Memory leak Pin
a_matseevsky26-Feb-13 10:59
a_matseevsky26-Feb-13 10:59 
GeneralRe: Memory leak Pin
Stefan_Lang26-Feb-13 22:44
Stefan_Lang26-Feb-13 22:44 
GeneralRe: Memory leak Pin
a_matseevsky27-Feb-13 2:09
a_matseevsky27-Feb-13 2:09 
GeneralRe: Memory leak Pin
Stefan_Lang27-Feb-13 2:52
Stefan_Lang27-Feb-13 2:52 
GeneralRe: Memory leak Pin
a_matseevsky27-Feb-13 11:44
a_matseevsky27-Feb-13 11:44 
Question[Solved] Memory leak in producer-consumer program Pin
noislude25-Feb-13 7:30
noislude25-Feb-13 7:30 
AnswerRe: Memory leak in producer-consumer program Pin
Richard Andrew x6425-Feb-13 10:08
professionalRichard Andrew x6425-Feb-13 10:08 
GeneralRe: Memory leak in producer-consumer program Pin
noislude25-Feb-13 10:23
noislude25-Feb-13 10:23 
GeneralRe: Memory leak in producer-consumer program Pin
Richard Andrew x6425-Feb-13 10:33
professionalRichard Andrew x6425-Feb-13 10:33 
GeneralRe: Memory leak in producer-consumer program Pin
noislude25-Feb-13 10:42
noislude25-Feb-13 10:42 
QuestionRe: Memory leak in producer-consumer program Pin
David Crow25-Feb-13 13:28
David Crow25-Feb-13 13:28 
AnswerRe: Memory leak in producer-consumer program Pin
noislude25-Feb-13 13:33
noislude25-Feb-13 13:33 
GeneralRe: Memory leak in producer-consumer program Pin
Stefan_Lang26-Feb-13 3:29
Stefan_Lang26-Feb-13 3:29 
GeneralRe: Memory leak in producer-consumer program Pin
noislude26-Feb-13 8:07
noislude26-Feb-13 8:07 
GeneralRe: Memory leak in producer-consumer program Pin
Stefan_Lang26-Feb-13 22:21
Stefan_Lang26-Feb-13 22:21 
GeneralRe: Memory leak in producer-consumer program Pin
noislude26-Feb-13 22:27
noislude26-Feb-13 22:27 
GeneralRe: Memory leak in producer-consumer program Pin
Stefan_Lang26-Feb-13 23:01
Stefan_Lang26-Feb-13 23:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.