Posts

Showing posts with the label memory-management

Forgot to deallocate infinite chunk of memory

Forgot to deallocate infinite chunk of memory In my Ubuntu machine, Codeblocks software I allocated infinite chunk of memory without any deallocation. And after that my machine became slow. After restarting the system everything seems ok. Will be there any problem in future? You can't allocate an infinite chunk of memory in the first place. – user2357112 Jul 1 at 5:19 Memory allocated by the usual mechanisms ( malloc , calloc , new , mmap , ...) is internal to the process and will be released when the process dies. Shared memory allocations ( shmget , semget , ...) can persist after the process dies, but will not survive a reboot. So your system should be back to normal, with no lingering effects from the large allocation. – ottomeister Jul 1 at 23:45 ...

Memory Mapped Region initial data

Memory Mapped Region initial data I want to create memory-mapped region using CreateFileMapping without any specific disk-file bound, but bound (using MapViewOfFileEx ) to a specific memory address. Protection of such region needs to be read-only from beginning. Then, I cannot write data to such a region. If this region would be created for specific disk-file, initial data would come from file content. How I can fill this read-only region with initial data? CreateFileMapping MapViewOfFileEx Example: Most Windows processes have memory regions which are mapped (and not bound to any file path) and read-only since creation, they contain data. How was this achieved? How were these regions filled with data? "bound(using MapViewOfFileEx) to specific process memory address" It's not clear what you mean by that. You can only map shared memory into your own process, not some other process. Sounds like an XY problem. What's your actual goal with all...