malloc
How to troubleshoot crashes in malloc
I have a large body of legacy code that I inherited. It has worked fine until now. Suddenly at a customer trial that I cannot repro开发者_JAVA百科duce inhouse, it crashes in malloc. I think that I nee[详细]
2023-04-05 20:56 分类:问答Was I just lucky that malloc returned a zero-filled buffer?
I tried running the code below: int main(){ char *ptr = (char*)malloc(sizeof(char)*20); ptr[5] = \'W\'; ptr[0] = \'H\';[详细]
2023-04-05 12:05 分类:问答New vs. Malloc, when overloading New
I\'m overloading new and delete to implement my own smal开发者_StackOverflow社区l-objects/thread-safe allocator.[详细]
2023-04-05 10:12 分类:问答problems with data entry and malloc in C
I\'m new to C and I\'m having a small problem with my code: int i, n; int *arr; while(n != 0) { scanf(\"%d\", &n);[详细]
2023-04-05 04:08 分类:问答convert c++ libraries to objective-c [closed]
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari[详细]
2023-04-05 01:27 分类:问答issue in putting custom fields in struct malloc_chunk
i am trying to put a head-tag and a foot tag inside struct malloc_chunk, like this: struct malloc_shunk {[详细]
2023-04-04 17:44 分类:问答When should I use free() in C?
The code works as it is supposed to, though it never frees the memory allocated by malloc(). I have tried to free memory in any place that I can, but no matter where I do it, it breaks the program. S[详细]
2023-04-04 05:25 分类:问答Inside Dynamics memory management
i am student and want to know more about the dynamics memory management. For C++, calling operator new() can allocate a memory block under the Heap(Free Store ). In fact, I have not a full picture how[详细]
2023-04-04 02:43 分类:问答What is wrong with realloc?
I have the following code which you can try using c99 filename.c; ./a.out #include <stdio.h> #include <stdlib.h>[详细]
2023-04-04 01:55 分类:问答How to avoid dynamically allocating memory to save time?
I have a function which is called many times in my project: void foo(int bar) { char arr[1024]; //...do some operation on arr according to value of bar[详细]
2023-04-03 20:52 分类:问答