memory

Improving memory usage in an array-wide filter to avoid block-processing

◇◆丶佛笑我妖孽 提交于 2020-01-14 18:00:32
问题 I am implementing some satellite image filters, starting with one known as the Enhanced Lee filter. The images are easily up to 5000x5000 pixels and more. My current implementation is running out of memory trying to compute the filters on those large arrays (note that the moving average and moving stddev filters can be run in one shot). The main difficulty is the number of arrays that must be kept in memory in order to return the final filtered array. In this question, I asked for help on

AccessViolationException in Release mode (C++)

我是研究僧i 提交于 2020-01-14 15:05:13
问题 I'm getting the following exception when I run my application in Release mode from Visual C++. Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at _cexit() at .LanguageSupport._UninitializeDefaultDomain(Void * cookie) at .LanguageSupport.UninitializeDefaultDomain() at .LanguageSupport.DomainUnload(Object source, Eve ntArgs arguments) at .ModuleUninitializer.SingletonDomainUnload(Objec t

How to make memory allocation in MSVC C++ deterministic?

有些话、适合烂在心里 提交于 2020-01-14 14:51:10
问题 While debugging some C++ code with tons of pointers it would be useful if the memory addresses between runs were the same. Is there any way to make the series of addresses that are returned between consecutive runs of a program that perform the same memory allocations deterministic? Maybe an environment variable or something that can be set for the debug heap? I am aware that there are many good reasons you want randomization for release builds, but determinism is handy for debugging in some

Want to increase Java Heap Size to 4GB+: Physical Memory 8 GB, JVM 64-bit

牧云@^-^@ 提交于 2020-01-14 14:28:06
问题 I want to run a memory intensive package on a web server. Current computer's settings are... Windows 7 64 bit 64-bit JVM RAM: 8GB When I try to run eclipse with -Xms1024m -Xmx2048m -XX:MaxPermSize=256m I get: Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. From posts that I read, it seems like I should be able to use more than 4GB of memory. When I ran the code, I was able to max out the memory at -Xmx1200M

How to copy a array of unmanaged memory into the same unmanaged memory

耗尽温柔 提交于 2020-01-14 13:47:06
问题 I reserved memory 10 items of 128 bytes IntPtr dst = Marshal.AllocHGlobal (10 * 128); IntPtr src1 = Marshal.AllocHGlobal (128); // .... init scr1 from DLL IntPtr src2 = Marshal.AllocHGlobal (128); // .... init scr2 from DLL I need to copy the 128 bytes elements of src1 and src2 to dst at the specified offset. Marshal.Copy not suitable for such purposes. Since the src and dst in unmanaged memory area. 回答1: The Window's API function memcopy should do the trick. [DllImport("msvcrt.dll",

How do I use MemoryFailPoint?

假如想象 提交于 2020-01-14 13:43:09
问题 A MemoryFailPoint (MSDN) " checks for sufficient memory resources before executing an operation." But how is it actually used correctly? Does the MemoryFailPoint automatically reserve some memory for the next big object I create? Or does it simply check whether the memory would be free, without reserving it? Does it check physical memory, physical memory plus page file, virtual address space, or something else entirely? When do I dispose it? Do I need to dispose the MemoryFailPoint before

Least intrusive compile barrier for Java on x86

谁都会走 提交于 2020-01-14 13:31:51
问题 If I hava a Java process interacting with some other process via a shared ByteBuffer or similar, what would be the least intrusive equivalent of a compiler barrier in C/C++? No portability is required - I am specifically interested in x86. For example I have 2 processes reading and writing to an area of memory as per the pseudocode: p1: i = 0 while true: A = 0 //Write to B A = ++i p2: a1 = A //Read from B a2 = A if a1 == a2 and a1 != 0: //Read was valid Due to the strict memory ordering on

valgrind Error: Conditional jump or move depends on uninitialised value(s)

╄→гoц情女王★ 提交于 2020-01-14 10:43:14
问题 I have one program: #include <stdio.h> int call(){ int x=25; ++x; return x; } int main(){ int p; p=call(); printf("%d",p); return 0; } When I compile the program with -g option and run it with valgrind it shows: ==15469== 1 errors in context 1 of 8: ==15469== Conditional jump or move depends on uninitialised value(s) ==15469== at 0x546F83: _dl_relocate_object (in /lib/ld-2.12.90.so) ==15469== by 0x53E6CC: dl_main (in /lib/ld-2.12.90.so) ==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12

What happens if i call nsobject init more than once? Does it increase retain count?

孤街浪徒 提交于 2020-01-14 10:37:32
问题 I'm pretty new to Objective-C and i have lots of troubles with memory management and still i understand a little. If i have an object, NSArray * myArray for example, and i do this myArray = [[NSArray alloc] initWithObjects:obj1,obj2,obj3,nil]; then i'm doing something and i want myArray to contain new objects and then i init it again [myArray initWithObjects:obj4,obj5,obj6, nil]; seems like it does what i need but is it correct grom the point of view of memory management?does it increase

vector<string> does not clear memory after out of scope

99封情书 提交于 2020-01-14 08:49:07
问题 i've encountered the following problem, and i'm not really sure whether i am wrong or its a really weird bug. I fill a huge array of strings and want it to be cleared at a certain point. Here's a minimal example #include <string> #include <vector> #include <unistd.h> //sleep #include <iostream> int main(){ { std::vector<std::string> strvec; for(long i = 0; i < 1000000; ++i){ std::string out = "This is gonna be a long string just to fill up the memory used by this fucking pthread\n"; strvec