virtual-memory

How to reduce virtual memory by optimising my PHP code?

£可爱£侵袭症+ 提交于 2019-12-06 00:16:17
My current code (see below) uses 147MB of virtual memory! My provider has allocated 100MB by default and the process is killed once run, causing an internal error. The code is utilising curl multi and must be able to loop with more than 150 iterations whilst still minimizing the virtual memory. The code below is only set at 150 iterations and still causes the internal server error. At 90 iterations the issue does not occur. How can I adjust my code to lower the resource use / virtual memory? Thanks! <?php function udate($format, $utimestamp = null) { if ($utimestamp === null) $utimestamp =

ARM Linux Page Table Entry format — unused bits?

无人久伴 提交于 2019-12-06 00:01:52
问题 This question was migrated from Unix & Linux Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . I need to use two bits of the PTE to store a custom "state" value that my kernel module will use when intercepting page protection faults. I am developing on a Galaxy Nexus which has an ARM Cortex A9 (ARM v7, I believe). Linux kernel version 3.0.31. The Linux PTE definitions are as follows (from arch/arm/include/asm/pgtable.h : /* * "Linux" PTE definitions. * * We

linking and paging in the system without virtual memory support

六眼飞鱼酱① 提交于 2019-12-05 19:41:53
First of all, is virtual memory a hardware feature of the system, or is it implemented solely by OS? During link-time relocation, the linker assigns run-time addresses to each section and each symbol, in the generated executable Do those run-time addresses correspond to virtual addresses? What if the system for which the executable is generated, does not use virtual memory? Next, if virtual memory is not used, then the application's address space is limited to the physical address space allocated for it by OS after load-time relocation Does page fault occur if no virtual memory is used? I

virtual v. physical memory in assessing C/C++ memory leak

穿精又带淫゛_ 提交于 2019-12-05 18:58:07
I have a C++ application that I am trying to iron the memory leaks out of and I realized I don't fully understand the difference between virtual and physical memory. Results from top (so 16.8g = virtual, 111m = physical): 4406 um 20 0 16.8g 111m 4928 S 64.7 22.8 36:53.65 client My process holds 500 connections, one for each user, and at these numbers it means there is about 30 MB of virtual overhead for each user. Without going into the details of my application, the only way this could sound remotely realistic, adding together all the vectors, structs, threads, functions on the stack, etc.,

Benefits of reserving vs. committing+reserving memory using VirtualAlloc on large arrays

风流意气都作罢 提交于 2019-12-05 14:24:39
I am writing a C++ program that essentially works with very large arrays. On Windows, I am using VirtualAlloc to allocate memory to my arrays. Now I fully understand the difference between reserving and committing memory using VirutalAlloc; however, I am wondering whether there is any benefit in committing memory page-by-page to a reserved region. In particular, MSDN ( http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx ) contains the following explanation for the MEM_COMMIT option: Actual physical pages are not allocated unless/until the virtual addresses are

How do I recover from EXC_BAD_ACCESS?

二次信任 提交于 2019-12-05 08:20:51
I'm intentionally causing an EXC_BAD_ACCESS . By triggering a write to an NSObject in a read-only virtual memory page. Ideally, I'd like to catch EXC_BAD_ACCESS , mark the virtual memory page as read-write and have execution continue as it normally would have. Is this even possible? The code I've written to cause the EXC_BAD_ACCESS is below. WeakTargetObject.h (ARC) @interface WeakTargetObject : NSObject @property (nonatomic, weak) NSObject *target; @end WeakTargetObject.m (ARC) @implementation WeakTargetObject @end main.m (MRR) - (void)main { char *mem = NULL; vm_allocate(mach_task_self(),

New Windows 8.1 APIs for virtual memory management: `DiscardVirtualMemory()` vs `VirtualAlloc()` and `MEM_RESET` and `MEM_RESET_UNDO`

此生再无相见时 提交于 2019-12-05 06:03:53
问题 Windows 8.1/Server 2012RC2 just introduced new APIs for virtual memory management: OfferVirtualMemory() , ReclaimVirtualMemory() , DiscardVirtualMemory() , which their usage is pretty straightforward, just by looking at their names. The thing I can't get is how these APIs work against VirtualAlloc() plus the flags MEM_RESET and MEM_RESET_UNDO , and what are the subtle differences. For the OfferVirtualMemory() , MSDN says that is very similar to VirtualAlloc() + MEM_RESET , except that it

Access denied error when using VirtualQueryEx

早过忘川 提交于 2019-12-04 16:23:57
So, I wrote a program which is able to successfully read memory from most of processes using VirtualQueryEx . However, I've come across a process for which this function fails. It's not a system process, just a game process. Without Debug privileges I couldn't even open the process's handle. With them I am able to get the process's handle but still get access denied for VirtualQueryEx . I'm not sure but maybe the process is private? If that's the case, what should I do to successfully use VirtualQueryEx function? I've also read somewhere that I might have to suspend whole process's threads

What happens to address's, values, and pointers after a fork()

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 07:34:32
I'm working on a question where I am to examine values and address before and after a fork() call in C. My approach was to display the variables values and address assuming to see a difference in the address after the fork() . Much to my surprise address's for said variables remained the same. My questions is why are they the same? What happens if I change a variable in the child? Will it change in both parent and child? If not, how am I able to change the value in that address while the address is the same for both parent and child. code(for reference): #include <stdio.h> #include <stdlib.h>

ARM Linux Page Table Entry format — unused bits?

若如初见. 提交于 2019-12-04 04:52:26
This question was migrated from Unix & Linux Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . Learn more . I need to use two bits of the PTE to store a custom "state" value that my kernel module will use when intercepting page protection faults. I am developing on a Galaxy Nexus which has an ARM Cortex A9 (ARM v7, I believe). Linux kernel version 3.0.31. The Linux PTE definitions are as follows (from arch/arm/include/asm/pgtable.h : /* * "Linux" PTE definitions. * * We keep two sets of PTEs - the hardware and the linux version. * This allows greater