memory-management

segmentation fault due to initialize() function when changing the size of the huge page allocation

a 夏天 提交于 2020-01-06 12:44:23
问题 I encounter segmentation fault in my program when I play with the size of the memory that I want to allocate with huge page, i.e., when I define LENGTH = 4*1024, there is seg fault. When I define 4*1024*1024, there is no seg fault. What is the root cause of this? Code below: #define _POSIX_C_SOURCE 199309 #define _GNU_SOURCE #include <sched.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> #include <fcntl.h> #include <time.h> #include <string.h> #include

what can I do to optimize the following function or some other thing to reduce memory consumption?

别说谁变了你拦得住时间么 提交于 2020-01-06 09:06:05
问题 I am working on business directory sort of thing, and need to show recursive parents of categories at category listing. I am using following function for that: public function get_recursive_parents($category_id){ $categories = array(); $res = $this->db->from('categories')->where('cat_id',$category_id)->get()->row_array(); $cat_id = $res['parent_id']; $categories[] = $res; while($cat_id){ $res = $this->db->from('categories')->where('cat_id',$cat_id)->get()->row_array(); $categories[] = $res;

Should CUDA Constant Memory be accessed warp-uniformly?

这一生的挚爱 提交于 2020-01-06 09:05:09
问题 My CUDA application has constant memory of less than 8KB. Since it will all be cached, do I need to worry about every thread accessing the same address for optimization? If yes, how do I assure all threads are accessing the same address at the same time? 回答1: Since it will all be cached, do I need to worry about every thread accessing the same address for optimization? Yes. The cache itself can only serve up one 32-bit word per cycle. If yes, how do I assure all threads are accessing the same

When and why will an OS initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete?

拜拜、爱过 提交于 2020-01-06 08:29:23
问题 I know that the OS will sometimes initialise memory with certain patterns such as 0xCD and 0xDD. What I want to know is when and why this happens. When Is this specific to the compiler used? Do malloc/new and free/delete work in the same way with regard to this? Is it platform specific? Will it occur on other operating systems, such as Linux or VxWorks? Why My understanding is this only occurs in Win32 debug configuration, and it is used to detect memory overruns and to help the compiler

RIPZoneDataAlloc

风格不统一 提交于 2020-01-06 07:27:25
问题 I am using instruments and seeing this: # Address Category Timestamp Live Size Responsible Library Responsible Caller 4 0xd84ba00 Malloc 10.00 KB 00:01.896.732 • 10240 libRIP.A.dylib RIPZoneDataAlloc What is RIPZoneDataAlloc and the libRIP.A.dylib? It seems to be taking up a large portion of the memory. Is it a symptom of something bad? I am using ARC and i0S 5. Thank you. 来源: https://stackoverflow.com/questions/9507212/ripzonedataalloc

RIPZoneDataAlloc

眉间皱痕 提交于 2020-01-06 07:27:07
问题 I am using instruments and seeing this: # Address Category Timestamp Live Size Responsible Library Responsible Caller 4 0xd84ba00 Malloc 10.00 KB 00:01.896.732 • 10240 libRIP.A.dylib RIPZoneDataAlloc What is RIPZoneDataAlloc and the libRIP.A.dylib? It seems to be taking up a large portion of the memory. Is it a symptom of something bad? I am using ARC and i0S 5. Thank you. 来源: https://stackoverflow.com/questions/9507212/ripzonedataalloc

Memory Freeing Inqury

坚强是说给别人听的谎言 提交于 2020-01-06 07:13:46
问题 Additional thanks extend to Daniel Newby for answering my memory usage question (and Martin York for explaining it a bit more) . It is definitely the answer I was looking for, but more of my other questions were answered by others. Thanks everyone for clearing up all of my concerns. Very pleased to see things running how I expect them to run. I've run into something that I'm not exactly sure about. In my program, I'm not using malloc() or free() . I'm making instances of my classes with new

After service call automatically variable value changing in loop

只愿长相守 提交于 2020-01-06 05:56:30
问题 I uploading zip file using chunk method. After some iteration completed in while loop TotalParts variable automatically changed to some value. When connected to debugger its works fine for some time, but when disconnected again value changed for some files. But, after some iteration finally it will upload.Value is changing in Jsonbody in http service. Actually TotalParts variable is final and also not declared inside while loop, although its changing to some value. public Boolean uploadFile

CakePHP error Allowed memory size exhausted

Deadly 提交于 2020-01-06 05:36:06
问题 On one of my PHP applications I get Allowed memory size exhausted error. What did i done wrong to get that error? It's showing on pages where i use more-less usual cakephp methods like 'find', to select record from database table, on index (list) pages. How can i fix that? problem is that i can not set memory size on commercial servers.... Thank you in advance! 回答1: Research the 'Containable' behavior for your models. It's a core behavior, and it sounds like you need to add it to your finds,

Memory exception in C# [duplicate]

丶灬走出姿态 提交于 2020-01-06 04:38:07
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: How to refer to children in a tree with millions of nodes I'm trying to implement a tree which will hold millions of nodes, which in turn can have an unspecified number of children nodes. To achieve this (since each node can have more than one child node), I'm storing a node's children within a Dictionary data structure. As a result of this, when each object node is created (out of millions), I've got a node