out-of-memory

Scala performance - Sieve

心已入冬 提交于 2020-01-15 12:53:27
问题 Right now, I am trying to learn Scala . I've started small, writing some simple algorithms . I've encountered some problems when I wanted to implement the Sieve algorithm from finding all all prime numbers lower than a certain threshold . My implementation is: import scala.math object Sieve { // Returns all prime numbers until maxNum def getPrimes(maxNum : Int) = { def sieve(list: List[Int], stop : Int) : List[Int] = { list match { case Nil => Nil case h :: list if h <= stop => h :: sieve

okhttp3 : unable to create new native thread

只愿长相守 提交于 2020-01-15 11:06:24
问题 Encountered a strange problem, I couldn't reproduce it after some attempts. How to reproduce it and why it happend? It's a non-concurrent task, Call the HTTP connection in a loop. public static Response syncGet(URL url) throws IOException { log.debug("http url:{}", url); OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(15L, TimeUnit.SECONDS) .readTimeout(30L, TimeUnit.SECONDS).build(); Request request = new Request.Builder().url(url).get().addHeader("cache-control", "no

okhttp3 : unable to create new native thread

旧街凉风 提交于 2020-01-15 11:06:05
问题 Encountered a strange problem, I couldn't reproduce it after some attempts. How to reproduce it and why it happend? It's a non-concurrent task, Call the HTTP connection in a loop. public static Response syncGet(URL url) throws IOException { log.debug("http url:{}", url); OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(15L, TimeUnit.SECONDS) .readTimeout(30L, TimeUnit.SECONDS).build(); Request request = new Request.Builder().url(url).get().addHeader("cache-control", "no

Linux c application memory usage

半城伤御伤魂 提交于 2020-01-15 10:52:25
问题 I have C Linux application which continuously allocates and frees memory (around 200 alloc/free per sec) using malloc, calloc, realloc & free functions. Even though all allocated memory are freed (verified by wrapping *alloc and free), the VmSize, VmRSS & VmData numbers are keep on increasing and finally application is getting killed by OOM killer. Why the VmSize, VmRSS & VmData are keep on increasing? if it is Memory management issue, any pointers to avoid this? I saw this Problem usage

OutOfMemoryException

空扰寡人 提交于 2020-01-15 05:14:48
问题 I have an application that is pretty memory hungry. It holds a large amount of data in some big arrays. I have recently been noticing the occasional OutOfMemoryException. These OutOfMemoryExceptions are occurring long before my application (ASP.Net) has used up the 800mb available to it. I have track the issue down to the area of code where the array is resized. The array contains a structure that is 74bytes in size. (I know that you shouldn't create struct's that are bigger than 16bytes),

How do I limit the memory resource of a group of docker containers?

♀尐吖头ヾ 提交于 2020-01-15 01:48:40
问题 I understand that I can use --memory and --memory-swap to limit memory resource per container. But, how do I limit memory resource per a group of containers? My system has 8GB RAM memory and consists of 2 docker containers. I want to set an 8 GB limit on both containers. I do not want to set a 4GB memory resource limit for each container as A container may use more than 4GB memory. Both containers won't use 4GB memory at the same time, so it would make sense to give the unused memory of

OutOfMemoryError when parsing XML in Clojure with data.zip

泄露秘密 提交于 2020-01-14 19:36:27
问题 I want to use Clojure to extract the titles from a Wiktionary XML dump. I used head -n10000 > out-10000.xml to create smaller versions of the original monster file. Then I trimmed with a text editor to make it valid XML. I renamed the files according to the number of lines inside ( wc -l ): (def data-9764 "data/wiktionary-en-9764.xml") ; 354K (def data-99224 "data/wiktionary-en-99224.xml") ; 4.1M (def data-995066 "data/wiktionary-en-995066.xml") ; 34M (def data-7999931 "data/wiktionary-en

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

Is there a upper limit on stack frame size

倖福魔咒の 提交于 2020-01-14 13:36:45
问题 We have an out of memory error for a heap but ( just asking out of curiosity ) is there an equivalent limit on size of an individual stack ? If not then what prevents such an overflow if excess memory is needed by a stack frame ( like thousands of local variable etc ) ? 回答1: If a thread requests more stack space than it has available it receives a StackOverflowError. http://docs.oracle.com/javase/7/docs/api/java/lang/StackOverflowError.html The size of an individual stack frame is determined

Is there a upper limit on stack frame size

荒凉一梦 提交于 2020-01-14 13:36:31
问题 We have an out of memory error for a heap but ( just asking out of curiosity ) is there an equivalent limit on size of an individual stack ? If not then what prevents such an overflow if excess memory is needed by a stack frame ( like thousands of local variable etc ) ? 回答1: If a thread requests more stack space than it has available it receives a StackOverflowError. http://docs.oracle.com/javase/7/docs/api/java/lang/StackOverflowError.html The size of an individual stack frame is determined