FFmpeg potential mem leak like behavior points. Are there such? [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
So I mean like it tries to educate it self and collects some data... Are there any such points/feilds in encoding part of ffmpeg (that I hope can be disabeld)?
BTW: My problem is simple: I looked thrue out all my code. It seriosly looks like it is some part of my ffmpeg windows build leaks memory a littel... all the time while I am encoding... So I hope ffmpeg is just triing to learn so that I would be able to tell ti not to learn!)

FFmpeg libraries use a very object-oriented design. All memory allocated should be kept track of in the context structures and freed when the relevant context is destroyed. There may be some one-time allocation and initialization of constant global data which one could call a "leak", but I believe that was all replaced with static const tables to facilitate better use of shared memory and eliminate memory leaks associated with dynamic loading. If you really think it's leaking (and if you care), you need to use some memory debugging tools to identify where the leaks might be and coordinate finding/fixing them with the developers.
If what you mean is that during a single encode, memory usage grows slightly, this is probably normal and to be expected. It shouldn't be much, and the memory should all be released when the encoding context is freed.

Related

how to completely free 2d multidimensional pointer array in c++ [duplicate]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I created an object which has few integer variables, and one char memory block say which is allocated with memory of 300-500 bytes as its members . After that this object was pushed in to vector by one thread, and then another thread which is running parallel will swap with one empty vector and start processing the vector which contains the object, after processing I used to delete the char block used in object and also finalized the object and deletd the object also. But it seems the memory was not freeing up. I ran this block of code with valgrind tool it doesn't show any leak. Please help me with the solution
But it seems the memory was not freeing up.
How are you determining that exactly? I assume incorrectly. Calling delete whatever marks that memory as deallocated and free for future use. The language doesn't specify exactly what that means. Your OS is better at managing memory than you are. It isn't forced to, for example, ensure that whatever tool (task manager?) you are using to measure memory usage now sees X more free bytes.
The memory you were using is now free to be allocated again. That's what you need to be concerned with, let the OS's memory manager worry about the details.

c++ cleaning the heap [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am having serious issues in the heap because in the previous programs, I did not delete the pointers variables. How do I clean the memory space/heap now to run the current programs?
Kill the offending processes, then the OS will clean up their memory for you.
For every allocation you make on the heap with new/malloc or other such functions you must delete/free the resource that you have used when you are finished with it.
C++ makes available some easy ways to do this with constructors allocating resources and destructors free'ing the resource.
Then there are lots of clever ways with std::auto_ptr or even other smart pointers that can help you manage this.
Basically you allocated it - so it is your job to free it.

C++: More and more complex bugs misleading the debugger [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
It seems like the bugs in my project are evolving. While in the beginning time, causers of program crashes were easily to spot using the debugger (the line it points to after the program crashes), it's different now.
Many bugs cause the program to crash in completely arbitary places not even closely related to them.
How can I spot bugs "hiding" from the debugger in a better way?
(I use Visual Studio 2010)
Profile your code for memory corruption, memory overwrites and memory leaks.
Root cause analysis.
When you find an obvious bug, don't just fix the bug, fix the coding style that allowed it.
If you have any code using raw memory and pointers, replace it by memory allocated using std::vector and its iterators. It will compile to exactly the same speedy code in Release mode, but in Debug mode it will used checked iterators, which will catch some bugs as early as possible.
Use memory corruption checking utilities, like gflags or debug heap. "Floating" crushes almost always come from corrupted memory in C++ programs

how to use video memory as standard memory storage? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I would use video memory on video board (256mb) as a standard memory for storing random values. I know very little about video graphics but i know that one approach is to just make 'models' or other video graphics objects storing my values, thus the video board thinks it processes video images or something this way. But is there another approach?
good article is http://en.gentoo-wiki.com/wiki/Using_Graphics_Card_Memory_as_Swap
that how linux has implemented it. Looks like i need to write windows device driver for graphics subsystem to access video memory.
MS resource about video memory: http://blogs.msdn.com/b/tmulcahy/archive/2009/02/11/windows-and-video-memory.aspx
This is a worse idea than you can possibly comprehend, but sure, you can always allocate a texture with DirectX and set it to be put in video memory only, write stuff in it, then at some later time lock it and read your data back out.
Good luck achieving a fifth of the speed you would by using normal system memory however.

How to fix heap corruption in c/c++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
This is a further question for my previous one here.
Is there a general solution for this?
Fix all dangling pointers
Fix all buffer overflows
Use pointers only where they are really needed
Reading your original post I'm not 100% you are facing a heap-corruption and you really hope you don't because if you would this is one of the most tricky errors to track down and AFAIK there are no solutions that always work.
However, if you are positive its a heap-corruption and you are on the windows platform you could try out the tool gflags. This advanced debugging tools allow you to install a debug heap manager in order to make it possible to find certain kinds of heap corruptions. One of the neat options it has is to make each allocation in it's own page or to write protect the heap datastructures. This makes it easier to pinpoint the exact location of the heap-corruption. It sucks lots of memory and CPU though.
Another tip if you are using Visual Studio is that if you manage to find that something is corrupting the data after a certain point of time and you wish to find the code that corrupts the data you can use Data Breakpoint to break whenever someone changes the data in question.
I wish you good luck.
Adding to swegi's answer I would check all your C++ constructors and all C initializations. Transform all dynamic C++ constructors (those where you put the init code in the function body) into static ones (where you initialize with the special constructor syntax). And be sure that you init all pointers and pointer members to 0. For C, I would initialize all variables.
Then, on unix I would use valgrind, usually this is quite good in finding all access violations and if you compile with all debugging options on it is able to trace it to the source line. There should be something similar on windows, too.