Linux process memory consumption in bytes (not Kbytes) - linux

In Linux is there any way to check processes memory measured on bytes (using top or ps for example). Not in kbytes, but bytes.
Thanks in advance!

Beyond the obvious answer of multiplying by 1024 (or 1000 if you want to be SI-correct)?
AFAIK top, ps etc. get their info from reading /proc/[PID]/status or something equivalent. Which reports info in KB. So I'd guess the answer to your question is no. Not that a positive answer would be useful, since memory is allocated from the kernel at page-level granularity, and the minimum page size Linux supports is 4 KB, so you wouldn't get more "resolution" by getting the memory consumption in bytes.

multiply kbytes by 1024

Related

Virtual memory limit on linux based ARM

I try to allocate memory using calloc(). The maximum size I can get is 1027 Mb (not 1024 Mb). I see this from the top command output. ulimit -v is set to unlimited. imx6q ARM. How can I allocate more memory? Thank you!
If you're on a 32-bit addressed architecture, theoretically you could use at most 4 GiB of virtual memory. Parts of them, however, is either reserved for kernel or allocated to hold library and program code, so it's possible you're left with less than 2 GiB of memory.

Increase conventional RAM in Wndows

I have a program that requires 512KB of conventional RAM but my cmd.exe only reports 500KB. My question is how do I increase RAM to the program. Thanks.
I'd say your best bet is to use a more modern programming language, but if you're constrained to QBASIC for whatever reason, you might give QB64 a try: https://www.qb64.org/
I managed to free some conventional ram by specifying:
rem config.nt file contents:
emm=ram
dos=high,umb
devicehigh=%SystemRoot%\system32\himem.sys
devicehigh=%SystemRoot%\system32\ansi.sys
files=255
After freeing up some RAM in Windows, using MEM declares the following:
655360 bytes total conventional memory
655360 bytes available to MS-DOS
626224 largest executable program size
1048576 bytes total contiguous extended memory
0 bytes available contiguous extended memory
941056 bytes available XMS memory
MS-DOS resident in High Memory Area
But what I cannot figure out is why the available contiguous extended memory is always 0?

Impact of Increasing GLIBC malloc() M_MMAP_THRESHOLD to 1GB

I am using glibc (version 2.21) for system with page size (2MB and 64MB). But with this very large page size, there is more fragmentation. So i increased the M_MMAP_THRESHOLD to 32MB using mallopt() still there is fragmentation. So i want to increase M_MMAP_THRESHOLD to 1 GB. Is there any impact of this on bin index calculation ?
This question was answered on the libc-help list:
If you increase M_MMAP_THRESHOLD, you also have to increase the heap size to something like 32 GiB (HEAP_MAX_SIZE in malloc/arena.c). The default of 2 * DEFAULT_MMAP_THRESHOLD_MAX is probably too small (assuming that DEFAULT_MMAP_THRESHOLD_MAX will be 2 GiB). Otherwise you will have substantial fragmentation for allocation requests between 2 GiB and HEAP_MAX_SIZE.

Large memory pages and fragmentation

I am using Linux + PPC64 where the memory page size is 64KiB. If I were to make two separate 32KiB allocations from within the same process, would that take up a single page in memory or two? Thanks!
kernel will assign 64KiB for each request less than 64 KiB.

maximum size of a string in matlab

I am a newbie at matlab and I am trying to solve the following scenario.
I have large strings which need to be xor'ed essentially encoded in order to get a value.
I am using the following code snippet to perform the operation :
clear;clc;
first ='abceeeeeeeeeeeeeeeddddddddddddd';
second='defrrrrrrrrrrrrttttttttttttuuuu';
result=bitxor(uint8(double(first)) , uint8(double(second)));
In the code above I am hard coding the value of the strings. I was wondering if matlab defines a size limit on the strings? If someone could help me to understand this value more in terms of bytes it will be very helpful.
Thanks and Regards,
Bhavya
I don't think tere is a size limit attached to the variable, but there is certainly a limit in term of available memory which depends on your operating system and computer architecture.
For example, I run Matlab R2008b on a 32 bits Windows 7. The output of the command memory gives me:
Maximum possible array: 1128 MB (1.183e+009 bytes) *
Memory available for all arrays: 1470 MB (1.542e+009 bytes) **
Memory used by MATLAB: 294 MB (3.085e+008 bytes)
Physical Memory (RAM): 3519 MB (3.690e+009 bytes)
* Limited by contiguous virtual address space available.
** Limited by virtual address space available.
I can create a character array of 5e8 elements before I raise an "out of memory" error, so that is 1e9 bytes, which is in agreement with the memory output.
You can check out the technical notes related to memory management on the MathWorks website:
Maximum Matrix Size by Platform
Memory Management Guide
Avoiding 'Out of Memory' Errors

Resources