out-of-memory

Python - Opening and changing large text files

五迷三道 提交于 2019-12-05 10:21:24
I have a ~600MB Roblox type .mesh file, which reads like a text file in any text editor. I have the following code below: mesh = open("file.mesh", "r").read() mesh = mesh.replace("[", "{").replace("]", "}").replace("}{", "},{") mesh = "{"+mesh+"}" f = open("p2t.txt", "w") f.write(mesh) It returns: Traceback (most recent call last): File "C:\TheDirectoryToMyFile\p2t2.py", line 2, in <module> mesh = mesh.replace("[", "{").replace("]", "}").replace("}{", "},{") MemoryError Here is a sample of my file: [-0.00599, 0.001466, 0.006][0.16903, 0.84515, 0.50709][0.00000, 0.00000, 0][-0.00598, 0.001472,

Optimizing SceneKit performance with high-res textures

放肆的年华 提交于 2019-12-05 09:49:39
I'm a fairly experienced iOS developer but a total SceneKit newbie, trying to simulate some planets in a basic app. To that end, I'm using high-res normal and diffuse maps of Mars, Venus, etc, applied to basic spheres. And they work! They look awesome, exactly what I was going for. The problem is, I'm getting killed by the quality/memory tradeoff. I can scale down the dimensions of the textures to reduce the memory footprint, but below a certain resolution the results (especially the normal map) start to look really mushy and terrible. The app needs to be able to zoom at least to where the

How does catching an OutOfMemoryException work?

余生长醉 提交于 2019-12-05 09:14:06
问题 I am a little bit confused about the fact that we can just catch an OutOfMemoryException using a try/catch block. Given the following code: Console.WriteLine("Starting"); for (int i = 0; i < 10; i++) { try { OutOfMemory(); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } } try { StackOverflow(); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } Console.WriteLine("Done"); The methods I used to create the OutOfMemory + StackOverflowException:

Does System.Net.Http.HttpClient suffer from HttpWebRequest.AllowWriteStreamBuffering?

自作多情 提交于 2019-12-05 08:48:09
I've been trying to use System.Net.Http.HttpClient to POST a larger file (+1GB) but it throws a SystemOutOfMemory exception: at System.Net.ScatterGatherBuffers.AllocateMemoryChunk(Int32 newSize) at System.Net.ScatterGatherBuffers..ctor(Int64 totalSize) at System.Net.ConnectStream.EnableWriteBuffering() at System.Net.HttpWebRequest.SetRequestSubmitDone(ConnectStream submitStream) at System.Net.Connection.CompleteStartRequest(Boolean onSubmitThread, HttpWebRequest request, TriState needReConnect) at System.Net.Connection.SubmitRequest(HttpWebRequest request, Boolean forcedsubmit) at System.Net

Out of Memory when using compresstojpeg on multiple YuvImage one at a time

梦想的初衷 提交于 2019-12-05 08:35:37
I am building an app that buffers N camera frames and when the user taps a button it saves the photo using all the saved frames applying an effect. I am saving the photo and processing the frames on an AsyncTask . When I execute it, I remove everything from the screen and leave only a TextView to display the progress of saving the photo. Currently the AsyncTask doInBackground looks like this: protected Void doInBackground(Integer... params) { int w = mBuffer.get(0).getWidth(); int h = mBuffer.get(0).getHeight(); int lineHeight = h / mBuffer.size(); int currentHeight = 0; Log.d("output",

Visual Studio Error: The “GenerateResource” task failed unexpectedly

Deadly 提交于 2019-12-05 08:10:52
When building a VS 2008 solution with 19 projects I sometimes get: The "GenerateResource" task failed unexpectedly. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.IO.MemoryStream.set_Capacity(Int32 value) at System.IO.MemoryStream.EnsureCapacity(Int32 value) at System.IO.MemoryStream.WriteByte(Byte value) at System.IO.BinaryWriter.Write(Byte value) at System.Resources.ResourceWriter.Write7BitEncodedInt(BinaryWriter store, Int32 value) at System.Resources.ResourceWriter.Generate() at System.Resources.ResourceWriter.Dispose(Boolean disposing)

How to analyze heap data from .hprof file and use it to reduce memory leaks?

南楼画角 提交于 2019-12-05 07:08:13
In recent times, I have encountered java.lang.OutOfMemoryError exception while running an application. During one such instance, I was able to get the heap dump using jvisualvm . I am able to open the .hprof heap dump file obtained from the heap dump using NetBeans 8.1 IDE but I am not aware of how to analyze the data dump. I'd like to know how to read the dump file and take corrective actions to reduce the out of memory exception from an application perspective. There are many ways to find the root cause of a memory leak, like using a profiler such as JProfiler and simply applying what is

OutOfMemoryException when creating large ZIP file using System.IO.Packaging

有些话、适合烂在心里 提交于 2019-12-05 06:36:32
I am trying to debug an OutOfMemoryException that occurs when creating a fairly large ZIP file using System.IO.Packaging.ZipPackage . The code is iterating through a large list of objects, doing the following for each object. Serializing the object data to a temporary file. Creating a PackagePart for the file. Copy from a source System.IO.Stream to another: Source stream: FileStream Target stream: PackagePart::GetStream() => MS.Internal.IO.Zip.ZipIOModeEnforcingStream Finally it calls Package::Close() which saves the file. The problem I am having is that for a particularly large list of

android java.lang.OutOfMemoryError

隐身守侯 提交于 2019-12-05 06:25:41
when i download large data from website, i got this error information: I/global (20094): Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required. D/dalvikvm(20094): GC freed 6153 objects / 3650840 bytes in 335ms I/dalvikvm-heap(20094): Forcing collection of SoftReferences for 3599051-byte al location D/dalvikvm(20094): GC freed 320 objects / 11400 bytes in 144ms E/dalvikvm-heap(20094): Out of memory on a 3599051-byte allocation. I/dalvikvm(20094): "Thread-9" prio=5 tid=17 RUNNABLE I/dalvikvm(20094): | group="main" sCount=0

how to correct this error: java.lang.OutOfMemoryError

和自甴很熟 提交于 2019-12-05 05:46:13
This is my code: public void onPictureTaken(byte[] data, Camera camera) { Bitmap foto = BitmapFactory.decodeByteArray(data, 0, data.length); wid = foto.getWidth(); hgt = foto.getHeight(); Bitmap newImage = Bitmap.createBitmap(wid, hgt, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(newImage); canvas.drawBitmap(foto, 0f, 0f, null); if (newImage.getWidth() > newImage.getHeight()) { Matrix matrix = new Matrix(); matrix.postRotate(90); newImage.createBitmap(newImage, 0, 0, wid, hgt, matrix, true); } } This is my error: FATAL EXCEPTION: main java.lang.OutOfMemoryError at android.graphics