Skip to main content

Questions tagged [memory-management]

Process of dynamically allocating and freeing portions of physical memory in order to respond to program requests with, if possible, fairness and no starvation among the requesters.

memory-management
0 votes
0 answers
31 views

Is there a way to force an NSObject to be allocated in stack or static memory?

I am asking this out of curiosity, because even if this can technically be done, this is almost certainly unsupported by Apple. As far as I can tell, only NSString literals, and possibly NSDictionary ...
CPlus's user avatar
  • 4,372
0 votes
1 answer
81 views

Copy constructor and creation of temporary object C++ [closed]

Let me use as example a vector object but it applies to any object. Is it safe to create an object as MyVector xyz(std::vector<double>(10)); assuming that there is a constructor which take as ...
Albert's user avatar
  • 11
0 votes
0 answers
6 views

NVIDIA cufft Memory free-up

When I loop through the following code, the GPU memory continues to increase #include <iostream> #include <cuda_runtime.h> #include "device_launch_parameters.h" #include <...
潘光健's user avatar
-1 votes
0 answers
25 views

How to traverse VMA in Linux 6.6 version? [duplicate]

In the old version of Linux(5.10), we can traverse VMA like that : static void walk_vma_range(struct mm_struct *mm, u32 *nr_vma, u32 *nr_pages) { struct vm_area_struct *vma = mm->mmap; u32 ...
Askemi Wang's user avatar
0 votes
1 answer
59 views

Do processes share the read-only sections of common dynamically loaded libraries?

I would like to verify how the memory consumption works when I have two different executables that depend on the same dynamically loaded library and the library has both "state" (i.e., ...
A.G's user avatar
  • 1
0 votes
0 answers
24 views

getting aligned pointer inside storage to place object

I have a storage in a form of an array of bytes. On the stack // storage on the stack, no requirement on alignment unsigned char storage[N]; Or on the heap // storage on the heap, no requirement on ...
Oersted's user avatar
  • 1,641
0 votes
0 answers
29 views

Getting heap storage with proper alignment in C++ for overaligned type

In some use case, you'll need to allocate storage before creating objects inside this storage. Then in order to create these objects, you may need to use placement new: T *pobj = new(pstorage); yet ...
Oersted's user avatar
  • 1,641
-1 votes
1 answer
60 views

Getting heap storage with proper alignment in C++ for non-overaligned type

In some use case, you'll need to allocate storage before creating objects inside this storage. Then in order to create these objects, you may need to use placement new: T *pobj = new(pstorage); yet ...
Oersted's user avatar
  • 1,641
0 votes
0 answers
17 views

When using `matplotlib.animation` and 'LineCollection`, how to reduce the size of the colors list

I am continuously plotting data using matplotlib.animation with multiple subplots that use a lot of segments. The issue I am running into is that size of the colors list is quite large ['Blue','Blue',....
THATS MY QUANT MY QUANTITATIVE's user avatar
1 vote
2 answers
108 views

printf does not call my version of malloc

I overwritten malloc to use a static buffer with TLSF allocation. but then when I call printf, the regular malloc is called instead of my custom malloc. void *malloc(size_t size) __attribute__((weak));...
Catalin Demergian's user avatar
0 votes
1 answer
65 views

Why is using JsonSerializer.DeserializeAsyncEnumerable to deserialize a 1GB file resulting in 2GB+ memory allocation?

I need to deserialize a 1GB json file one element at a time in a streaming fashion and after doing some reading found JsonSerializer.DeserializeAsyncEnumerable to enable this while also keeping the ...
DeanOfHouseAkin's user avatar
0 votes
0 answers
19 views

possible compilation problems and strange behavior of the memory allocation in C

I have a program in C that gets a continued fractional representation. It works fine, but shows an unpredictable behavior for some test cases (one of them is hard coded in program). In one from five ...
nikmal's user avatar
  • 11
0 votes
0 answers
36 views

Can a kernel memory address indicate its type of allocation?

I'm troubleshooting some Linux kernel code, and it would be nice to know where the memory pointer allocation originated. Question: Are there Linux kernel macros available like ADDR_IS_STACK_ADDR(ptr) ...
KJ7LNW's user avatar
  • 1,781
0 votes
1 answer
62 views

When a user process swaps out a page, is the virtual address of the page in user space or kernel space?

I am a beginner in Linux and have always been confused about the difference between kernel space and user space. I am currently researching memory management and would like to know if the virtual ...
Mia8Cew's user avatar
2 votes
3 answers
93 views

Why does the Rust compiler drop unused variables in the reverse order they were declared?

In the Rust book an example is provided in chapter 15 section 3 to show when Rust runs the drop function on the variables c and d. struct CustomSmartPointer { data: String, } impl Drop for ...
Anthony Ruiz's user avatar

15 30 50 per page
1
2 3 4 5
1839