memory-management

Does C# app exit automatically dispose managed resources?

故事扮演 提交于 2020-01-23 06:16:13
问题 I am fully aware that using statements are the way to handle IDisposables. Please do not repeat this advice in comments. When a C# .NET 4.5 (or higher) application closes, what happens to the IDisposables which were not properly disposed? I know some have a finalizer for disposing unmanaged resources. But let's say I have a console app, with a static Stream variable. Is it disposed when I close the console app? What about a HttpClient? And how do you know in which situations it does and in

What is the difference between storing a Vec vs a Slice?

房东的猫 提交于 2020-01-23 05:42:27
问题 Rust provides a few ways to store a collection of elements inside a user-defined struct. The struct can be given a custom lifetime specifier, and a reference to a slice: struct Foo<'a> { elements: &'a [i32] } impl<'a> Foo<'a> { fn new(elements: &'a [i32]) -> Foo<'a> { Foo { elements: elements } } } Or it can be given a Vec object: struct Bar { elements: Vec<i32> } impl Bar { fn new(elements: Vec<i32>) -> Bar { Bar { elements: elements } } } What are the major differences between these two

_Expand versus new versus GNU

风流意气都作罢 提交于 2020-01-23 05:22:55
问题 Recently, I made a new friend. His name is _expand, and we've had some nice conversations, and I've even hung out with him a few times. But when I started asking around, no one had ever heard of my _expand. I became suspicious. I called a few thoroughly non-metaphorical friends at microsoft, and a few friends elsewhere in the business. Nothing. No one had ever used it. I noodled around various search engines and source trees. Nothing except a cursory mention here and there. Certainly not

Adobe Air for Windows 64 bit?

不问归期 提交于 2020-01-23 03:44:11
问题 We are developing some memory intensive Adobe Air Desktop applications that sometimes peek above the 32 bit 1.3 Gb Limit in Windows and get purged by the OS. Unfortunately we can't find any options from Flex Builder to export to Windows 64 bit. It seems from the Adobe forum that more people are interested in this feature and Adobe seems not committed yet to implemented it. If anyone has the same issue and would like this supported please vote on the Adobe forum: https://bugbase.adobe.com

Does using static methods and properties in PHP use less memory?

一世执手 提交于 2020-01-22 17:21:29
问题 I'm working on a web application that sees dozens of concurrent users per second. I have a class that will be instantiated many times within the same page load. In that class, I have some properties that will always be the same across every object, so I'm thinking about declaring these properties as static in an effort to reduce the memory that will be used when multiple instances of this class are instantiated during the same page request. Will doing this use less memory for this application

Does using static methods and properties in PHP use less memory?

喜欢而已 提交于 2020-01-22 17:20:07
问题 I'm working on a web application that sees dozens of concurrent users per second. I have a class that will be instantiated many times within the same page load. In that class, I have some properties that will always be the same across every object, so I'm thinking about declaring these properties as static in an effort to reduce the memory that will be used when multiple instances of this class are instantiated during the same page request. Will doing this use less memory for this application

How does ptr_vector manage memory?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-22 15:26:06
问题 I'm currently getting myself into c++ for lower level coding with opengl. I come from a heavy objc background so I have some understanding about memory management but I can't seem to get how the "boost" library manages container types like ptr_vector . I think my problem is related to the fact that I have no idea how ptr_vector manages the destruction of itself and its objects. Please take a look at the following code: // Header file ... ptr_vector<IObject3D> objects; ... // Implementation

How does ptr_vector manage memory?

爱⌒轻易说出口 提交于 2020-01-22 15:26:05
问题 I'm currently getting myself into c++ for lower level coding with opengl. I come from a heavy objc background so I have some understanding about memory management but I can't seem to get how the "boost" library manages container types like ptr_vector . I think my problem is related to the fact that I have no idea how ptr_vector manages the destruction of itself and its objects. Please take a look at the following code: // Header file ... ptr_vector<IObject3D> objects; ... // Implementation

Under what circumstances can malloc return NULL?

老子叫甜甜 提交于 2020-01-22 04:49:07
问题 It has never happened to me, and I've programming for years now. Can someone give me an example of a non-trivial program in which malloc will actually not work? I'm not talking about memory exhaustion : I'm looking for the simple case when you are allocating just one memory block in a bound size given by the user, lets say an integer, causes malloc to fail. 回答1: Yes. Just try to malloc more memory than your system can provide (either by exhausting your address space, or virtual memory -

Cloud Functions for Firebase killed due to memory limit exceeded

自闭症网瘾萝莉.ら 提交于 2020-01-22 04:40:07
问题 I keep getting a sporadic error from Cloud Functions for Firebase when converting a relatively small image (2mb). When successful, the function only takes about 2000ms or less to finish, and according to Image Magick documentation should I should not see any problems. I tried increasing the buffer size for the command, which isn't allows from within Firebase, and I tried to find alternatives to .spawn() as that could be overloaded with garbage and slow things down. Nothing works. 回答1: I was