Tag Info

New answers tagged

0

The key here is this: While I can see that, it is also true that our project does need accurate memory debugging, as I already found memory corruption, double frees and uninitialised variables. This pretty much directly implies that your codebase is cobbled together from nothing more than hope and string. Competent C++ programmers do not have ...


0

One good approach would be to narrow down the discussion with your colleagues by means of classification. Given a large code base, certainly there is not one single reason but rather multiple, (identifiable) reasons for long living objects. Examples: Long living objects which are not referenced by anyone (real leaks). It is a programming logic error. Fix ...


2

Add a switch to the server process that can be used during valgrind measurements that will release all of the memory. You can use this switch for testing. The impact will be minimal during normal operations. We had a long running process that would take several minutes to releases 1000’s of objects. It was much more efficient to just exit and let them die. ...


0

IMHO, the lifetimes of these objects should never just be made and left to die when the system shuts down. This reeks of global variables, which we all know are bad bad bad bad bad. Especially in the age of smart pointers, there is no reason to do this other than laziness. But more importantly, it adds a level of technical debt to your system that someone ...


4

You have a basic misunderstanding of how virtual memory works. The virtual memory space of a process is a linear list of addresses, 0 to N. The addresses within the virtual memory space are segmented into pages, and those pages may reside either in RAM or on disk (although they must be moved to RAM to execute). So your diagram needs three blocks: To ...


2

It could run in theory, but the ratio 15/10 is significant enough to probably make thrashing happens. If that is the case, the process could run many thousand times slower (because too often the kernel would fetch some page from the disk and pageout another page); if your disk is still a real rotating disk (not an SSD) it would make a lot of noise. ...


3

The important thing to understand about virtual memory is that it's, um, virtual. For example, a process might think it has 20 MiB of virtual memory. However, 5 MiB of that might be part of a memory mapped file that hasn't been loaded from disk, 5 MiB might look like a large area that's full of zeros (but might be the same tiny area full of zeros repeated ...


3

The entire point of virtual memory is to be able to run processes that require more RAM than you have RAM chip in your computer. If it couldn't do that, you wouldn't be any better off than without it. As Robert Harvey has explained, the way of providing this capability is to intercept all memory accesses the process makes and loading them into physical ...


0

Your suggestion isn't quite right. int A[x][y]; (where 'x' and 'y' are expressions that can be evaluated to a constant at compile time) declares a single block of memory that is xysizeof(int) bytes long, and A[i][j] is translated to a reference to the I*y+jth value in the block. On the other hand, int ** A = new int *[x]; allocates an array of x ...


-2

Some languages have types named according to the value format and bit width. C++ has int32_t, .NET has Int32, and Go has int32. All programmers should immediately recognize the meaning of a derived term like int24, so I think it would be acceptable to use anywhere that an alternative term has not been provided. There are even implementations on SO for C++ ...


8

Where are primitive fields stored? Primitive fields are stored as part of the object that is instantiated somewhere. The easiest way to think of where this is - is the heap. However, this is not always the case. As described in Java theory and practice: Urban performance legends, revisited: JVMs can use a technique called escape analysis, by which ...



Top 50 recent answers are included