memory-management

Lock-free memory reclamation with hazard pointers

我只是一个虾纸丫 提交于 2020-01-01 02:30:13
问题 Hazard pointers are a technique for safely reclaiming memory in lock-free code without garbage-collection. The idea is that before accessing an object that can be deleted concurrently, a thread sets its hazard pointer to point to that object. A thread that wants to delete an object will first check whether any hazard pointers are set to point to that object. If so, deletion will be postponed, so that the accessing thread does not end up reading deleted data. Now, imagine our deleting thread

How is heap and stack memories mananged, implemented, allocated [duplicate]

隐身守侯 提交于 2020-01-01 00:45:10
问题 This question already has answers here : Closed 10 years ago . Possible Duplicates: How is heap and stack memories mananged, implemented, allocated? Stack,Static and Heap in C++ In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap. How is each implemented? How is it managed (high level)? Does gcc preallocates a chunk of memory to be used for the stack and heap, and then doles out on request? Is original memory coming from RAM? Can a

Get CPU usage IOS Swift

早过忘川 提交于 2019-12-31 23:17:03
问题 I am trying to get overall CPU usage not of a single app. I found some of the resources but they are either written in C or outdated swift. Can anyone help me with this problem? I am trying to conver this https://github.com/beltex/SystemKit/blob/master/SystemKit/System.swift#L12 to swift. Till now I am able to convert this much fileprivate func hostCPULoadInfo() -> host_cpu_load_info{ let HOST_CPU_LOAD_INFO_COUNT = MemoryLayout<host_cpu_load_info>.stride / MemoryLayout<integer_t>.stride; var

Get CPU usage IOS Swift

旧巷老猫 提交于 2019-12-31 23:14:11
问题 I am trying to get overall CPU usage not of a single app. I found some of the resources but they are either written in C or outdated swift. Can anyone help me with this problem? I am trying to conver this https://github.com/beltex/SystemKit/blob/master/SystemKit/System.swift#L12 to swift. Till now I am able to convert this much fileprivate func hostCPULoadInfo() -> host_cpu_load_info{ let HOST_CPU_LOAD_INFO_COUNT = MemoryLayout<host_cpu_load_info>.stride / MemoryLayout<integer_t>.stride; var

Why don't memory allocators actively return freed memory to the OS?

耗尽温柔 提交于 2019-12-31 23:12:06
问题 Yes, this might be the third time you see this code, because I asked two other questions about it (this and this).. The code is fairly simple: #include <vector> int main() { std::vector<int> v; } Then I build and run it with Valgrind on Linux: g++ test.cc && valgrind ./a.out ==8511== Memcheck, a memory error detector ... ==8511== HEAP SUMMARY: ==8511== in use at exit: 72,704 bytes in 1 blocks ==8511== total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated ==8511== ==8511== LEAK SUMMARY:

Process Memory limit of 64-bit process

左心房为你撑大大i 提交于 2019-12-31 21:33:27
问题 I currently have a 32-bit .Net application (on x86 Windows) which require lots of memory. Recently it started throwing System.OutOfMemoryException's. So, I am planning to move it to a x64 platform as 64-bit process. So will this help with the out of memory exceptions. I was reading this article from MSDN Memory limits for Windows So, my question is if I compile a 64bit .Net application, will it have IMAGE_FILE_LARGE_ADDRESS_AWARE set as default (As the article suggests)? i.e will I be able to

When should I consider using a in memory database and what are the issue to look out for?

有些话、适合烂在心里 提交于 2019-12-31 17:54:15
问题 I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, none disk based databases are being used less, e.g most applications are now built on conventional rational databases. I would have expected the opposite as RAM is getting close to being free for a lot of

When should I consider using a in memory database and what are the issue to look out for?

旧时模样 提交于 2019-12-31 17:53:19
问题 I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, none disk based databases are being used less, e.g most applications are now built on conventional rational databases. I would have expected the opposite as RAM is getting close to being free for a lot of

Core Data Memory Management

人走茶凉 提交于 2019-12-31 14:42:34
问题 I've read the memory management sections in the Core Data docs and I'm still a little confused. I have one context in my app, and I have several things getting objects out of it. For example a few fetched results controllers, detail views and some other code fetching random objects. Once objects have been fully released and their retain count is 0, will core data automatically release all the object information and fault them? I'm pulling lots of data into my context in some of my fetched

Three js memory management

陌路散爱 提交于 2019-12-31 13:08:12
问题 I have a large scene with a lot of Mesh and MorphAnimMesh. I want to free memory when the meshes are removed. If i know right this is the best way to do: for ( var i = scene.children.length - 1; i >= 0 ; i -- ) { var obj = scene.children[i]; scene.remove(obj); obj.deallocate(); obj.geometry.deallocate(); obj.material.deallocate(); obj.material.map.deallocate(); } if i check the memory usage at task manager after this, nothing changes. ( tried to wait a few min for GC but nothing. ) Google