out-of-memory

Need help resolving an error when WCF service returns DataTable: OutOfMemoryException

青春壹個敷衍的年華 提交于 2020-01-14 04:00:31
问题 I have a WCF service running that is attempting to return a DataTable . The service method uses a SqlDataReader , and then uses DataTable.Load() to get that data into the DataTable it intends to return. Problem: when the service method returns a large table (I'll define this in a moment), I get these exceptions in the debug output (they do not cripple the service): A first chance exception of type 'System.OutOfMemoryException' occurred in SMDiagnostics.dll A first chance exception of type

java out of memory then exit

岁酱吖の 提交于 2020-01-14 02:07:46
问题 I have a piece of software that has to analyze big files. Constraining the input or giving infinite memory is not an option, so I have to live with flying OOMEs. Because the OOME only kills the Thread, my software runs in some crappy state. From outside everything looks okay because the process is running but on the inside it's braindead. I would like to pull the plug on it. But how can I do this? Catching a OOME does not guranteee that the next line of code will be executed. e.g System.exit

Possible reasons for FileStream.Write() to throw an OutOfMemoryException?

依然范特西╮ 提交于 2020-01-13 18:39:28
问题 I have 10 threads writing thousands of small buffers (16-30 bytes each) to a huge file in random positions. Some of the threads throw OutOfMemoryException on FileStream.Write() opreation. What is causing the OutOfMemoryException ? What to look for? I'm using the FileStream like this (for every written item - this code runs from 10 different threads): using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite, BigBufferSizeInBytes, FileOptions

Why are all my bitmaps upsampled 200%?

主宰稳场 提交于 2020-01-13 09:51:28
问题 I'm having severe memory issues in my application [1]. In order to investigate this, I took heapdumps of my app at different states. I saw that some bitmaps were taking huge amounts of memory. I wrote a small tool [2] that decodes the byte arrays to Windows bitmap files (.bmp), so that I can see the bitmaps and compare them to the files I have in my res/drawable folder. What I discovered is that all my files are upsampled twice. I first checked with the biggest one had: a byte array buffer of

How to handle try catch exception android

邮差的信 提交于 2020-01-12 07:16:46
问题 I am using a method getBitmap to display images. As I am using this as a method,if it returns bitmap display an image but if it returns null,catch an exception. But if url entered is wrong also, it should handle the FileNotFoundException. How to handle two exception and display in UI? public Bitmap getBitmap(final String src) { try { InputStream stream = null; URL url = new URL(src); java.net.URL url = new java.net.URL(src); URLConnection connection = url.openConnection(); InputStream input =

split huge 40000 page pdf into single pages, itextsharp, outofmemoryexception

怎甘沉沦 提交于 2020-01-11 15:59:32
问题 I am getting huge PDF files with lots of data. The current PDF is 350 MB and has about 40000 pages. It would of course have been nice to get smaller PDFs, but this is what I have to work with now :-( I can open it in acrobat reader with some delay when loading but after that acrobat reader is quick. Now I need to split the huge file into single pages, then try to read some recipient data from the pdf pages, and then send the one or two pages that each recipient should get to each particular

How do I read a large file from disk to database without running out of memory

白昼怎懂夜的黑 提交于 2020-01-11 06:18:09
问题 I feel embarrassed to ask this question as I feel like I should already know. However, given I don't....I want to know how to read large files from disk to a database without getting an OutOfMemory exception. Specifically, I need to load CSV (or really tab delimited files). I am experimenting with CSVReader and specifically this code sample but I'm sure I'm doing it wrong. Some of their other coding samples show how you can read streaming files of any size, which is pretty much what I want

How to increase heap size for jBoss server

这一生的挚爱 提交于 2020-01-10 12:46:09
问题 I have an upload files scenario in my project. When I'm trying to upload the large files it's giving me an OutOfMemory error. That error is related to Java heap size. How can you increase the heap size in Java and which file do I need to alter for this? I'm using jboss 5.1 server for running my application. 回答1: You can set it as JVM arguments the usual way, e.g. -Xms1024m -Xmx2048m for a minimum heap of 1GB and maximum heap of 2GB. JBoss will use the JAVA_OPTS environment variable to include

Low memory writing/reading with Apache POI

蓝咒 提交于 2020-01-10 03:06:49
问题 I'm trying to write a pretty large XLSX file (4M+ cells) and I'm having some memory issues. I can't use SXSSF since I also need to read the existing cells in the template. Is there anything I can do to reduce the memory footprint? Perhaps combine streaming reading and streaming writing? 回答1: To handle large data with low memory, the best and I think the only option is SXSSF api-s. If you need to read some data of the existing cells, I assume you do not need the entire 4M+ at the same time. In

Unable to write into DataOutputStream beyond a specific size - OutOfMemoryError

最后都变了- 提交于 2020-01-10 03:04:42
问题 I have the following code which produces an OutOfMemory exception: byte[] buf = new byte[10240]; int len = 0; DataOutputStream dataOS = new DataOutputStream(conn.getOutputStream()); while ((len = _inputStream.read(buf)) > 0) { System.out.println("len : " + len); System.out.println("Going to write buf into dataOS : " + buf.length); dataOS.write(buf, 0, len); System.out.println("dataOS.size() : " + dataOS.size()); } _inputStream.close(); The following is the last few lines from the debug output