memory-management

Java garbage collection problem

对着背影说爱祢 提交于 2020-01-06 04:26:27
问题 So I have this extremely memory-intensive Java application I'm building, which builds a tree of millions of nodes. Using the handy dandy Runtime methods for getting heap information, I built a nice little method that displays the current memory usage, as shown below: public void displayMemoryUsage() { long maxMem = Runtime.getRuntime().maxMemory(); long freeMem = Runtime.getRuntime().freeMemory(); long heapMem = Runtime.getRuntime().totalMemory(); long usedMem = heapMem - freeMem; System.out

Can I with PTEs from one process which indicate to fragments of physical memory to create appropriate PTEs in other process?

末鹿安然 提交于 2020-01-06 03:14:48
问题 When we in Linux use function mmap (,,, MAP_ANON | MAP_SHARED); , then for the same region of fragmented physically memory (which allocated) between processes are allocating virtual memory pages (PTEs). Ie these PTEs are copied from page table of one process to the page table of another process (with the same sequence of fragments of physical addresses allocated memory), is this true? But mmap () needs to be done before fork () . And if we already have two working process (ie after fork () ),

C++ When to allocate on heap vs stack?

こ雲淡風輕ζ 提交于 2020-01-06 02:29:06
问题 Whilst asking another question (and also before) I was wondering how do I judge whether to create an object on the heap or keep it as an object on the stack? What should I ask myself about the object to make the correct allocation? 回答1: Put it on the heap if you have to, the stack if you can. What kinds of things do you need to put on the heap? Anything of varying length. Any object that might need to be null. Anything that's very large, lest you cause a stack overflow. 回答2: Simple answer.

malloc error - incorrect checksum for freed object - object was probably modified after being freed

心不动则不痛 提交于 2020-01-06 01:53:17
问题 I'm trying to get sub data of NSData object and at the same time multiple bytes by some value for my personal need . actually this affect the volume of .wav sound file . but i get after few calls to the following function a malloc error at the malloc statement . +(NSData *) subDataOfData: (NSData *) mainData withRange:(NSRange) range volume (CGFloat) volume { // here is the problematic line: Byte * soundWithVolumeBytes = (Byte*)malloc(range.length); Byte * mainSoundFileBytes =(Byte *)

Is there an easy way to prepare Fortran code for parallel invocation

旧街凉风 提交于 2020-01-05 19:14:18
问题 I want to solve multiple large ODE systems in a C++ program in parallel using OpenMP. For certain reasons I need to use an ODE solver for which I could only find a Fortran 90 subroutine, and the code is too large to simply translate it to C. I know that Fortran uses static memory extensively and that I therefore have to prime the code for parallel invocations; but I am not really familiar with the language so: Is there a standard (automated) solution for my problem? Which parts of the code do

Is there an easy way to prepare Fortran code for parallel invocation

冷暖自知 提交于 2020-01-05 19:13:40
问题 I want to solve multiple large ODE systems in a C++ program in parallel using OpenMP. For certain reasons I need to use an ODE solver for which I could only find a Fortran 90 subroutine, and the code is too large to simply translate it to C. I know that Fortran uses static memory extensively and that I therefore have to prime the code for parallel invocations; but I am not really familiar with the language so: Is there a standard (automated) solution for my problem? Which parts of the code do

Navigation arc memory not released

巧了我就是萌 提交于 2020-01-05 19:10:52
问题 I have two table table controllers A and B. A has a list of items and when an item is clicked, it pushes to B. The problem is that when B was shown, the instrutment indicated a live memory increase, but it did not decreased when I clicked on back button. The dealloc method in B was executed but the memory seemed changed slightly. I checked that B was not retained anywhere else so what may the reasons that can cause this problem? In B, there are many textfields, labels which are nonatomic and

Where to release an object? dealloc or ViewDidUNload

心不动则不痛 提交于 2020-01-05 17:37:14
问题 When we need to release an object,where to do it, either at the dealloc method or in the ViewDidUnload for a viewController? which would be better? I think that viewDidUnload would do better, because once the view controller is unloaded the objects would be released. And in the dealloc case, from the documentation When an application terminates, objects may not be sent a dealloc message. Because the process’s memory is automatically cleared on exit, it is more efficient simply to allow the

how to cache 1000s of large C++ objects

帅比萌擦擦* 提交于 2020-01-05 13:09:43
问题 Environment: Windows 8 64 bit, Windows 2008 server 64 bit Visual Studio (professional) 2012 64 bits list L; //I have 1000s of large CMyObject in my program that I cache, which is shared by different threads in my windows service program. For our SaaS middleware product, we cache in memory 1000s of large C++ objects (read only const objects, each about 4MB in size), which runs the system out of memory. Can we associate a disk file (or some other persistent mechanism that is OS managed) to our

how to cache 1000s of large C++ objects

十年热恋 提交于 2020-01-05 13:09:02
问题 Environment: Windows 8 64 bit, Windows 2008 server 64 bit Visual Studio (professional) 2012 64 bits list L; //I have 1000s of large CMyObject in my program that I cache, which is shared by different threads in my windows service program. For our SaaS middleware product, we cache in memory 1000s of large C++ objects (read only const objects, each about 4MB in size), which runs the system out of memory. Can we associate a disk file (or some other persistent mechanism that is OS managed) to our