Sponsored Content
Full Discussion: realloc() fails
Top Forums Programming realloc() fails Post 302547908 by Corona688 on Wednesday 17th of August 2011 02:08:42 AM
Old 08-17-2011
Quote:
Originally Posted by mamboknave
Instead of storing them first on HD and then loading them in memory, it's *much* faster receiving them directly in memory.
Why would that be? All memory is swap backed technically, this is just disk-backed instead. If you save it on disk it'll be in cache, and cache is memory too. It gets paged in on-demand just like any other memory, with the advantage of not wasting swap space. It's quite efficient actually.

---------- Post updated at 12:08 AM ---------- Previous update was at 12:06 AM ----------

Quote:
Originally Posted by mamboknave
How should I interpret these info?
That you've used up 3 gigabytes of address space if not memory, way beyond the limit I'd have suspected your program would begin to bug out on. In any case the reason for the errors is clear. You're running out of address space.

mmap() might be able to fill in the corners you're not using, but there's not a lot left to be had.
 

10 More Discussions You Might Find Interesting

1. Programming

Realloc

Can Any body give me a exampla which has the usage of realloc i want a function which uses realloc & increases /decreases the size of a pointer (0 Replies)
Discussion started by: wojtyla
0 Replies

2. Programming

Does realloc free fairly?

Hello, my program works properly but valgrind tells me I am not freeing allocated memory. I think the problem is in realloc. I am pretty sure I do something wrong with realloc, because I changed it a bit and valgrind noticed less errors (that the program wasn't working properly with less errors... (3 Replies)
Discussion started by: samciz
3 Replies

3. Programming

help with realloc() on Linux

hi, I'm using gcc version 3.4.6 on a Red Hat system... (not sure how to determine version of glibc) when i run the following, i get: glibc detected *** realloc(): invalid next size: 0x0804a170 I'm not sure what is wrong. The error happens on the second iteration of the while loop.... (3 Replies)
Discussion started by: Andrewkl
3 Replies

4. Programming

tolower (static pointer + malloc + realloc)

N00B here. This function would be easier using a char pointer along with free. But I wish to learn how to use char static pointers (they do not require free, right ?). How do I erase the content of a static pointer ? Terminating the string works but the static pointer's content is not being... (4 Replies)
Discussion started by: limmer
4 Replies

5. Programming

malloc vs realloc

Why when using realloc, john is reversed 3 times but not the other 2 names ? But if I use malloc, then the 3 names are reversed correctly ? (but then there is a memory leak) How can I reverse all 3 names without a memory leak ? char *BUFFER = NULL; char *STRREVERSE(const char *STRING) {... (5 Replies)
Discussion started by: cyler
5 Replies

6. Programming

What happens when realloc() fails?

Hi, I am seeing varying results about, when realloc() fails in reallocation. Which one is correct out of the below? a) realloc() maintains the original pointer (i.e) the original pointer is left unaltered/untouched but relloc() returns the NULL value. b) original buffer pointer is lost... (3 Replies)
Discussion started by: royalibrahim
3 Replies

7. Programming

realloc fails in C : what next ?

Hi all I'm trying to use someone else's software, which has a realloc that fails in it. This is probably due to memory limitations, as it only happens when I use this software on huge datasets. First question : how to diagnose if it's a soft or hard limitation? I mean, if it's due to my... (10 Replies)
Discussion started by: jossojjos
10 Replies

8. Programming

Realloc() question

b = realloc(a, 1000); if realloc succeeds and b!=a (not in-place replacement), does realloc automatically free a or I should free both a and b afterwards? thank you! (5 Replies)
Discussion started by: bashuser2
5 Replies

9. UNIX for Dummies Questions & Answers

about realloc routing

#include <malloc.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int* allocat_array(void) { int *array; int tmp; int n_values = 0 ; array = malloc(sizeof(int)); if(array == NULL) return NULL; while(scanf("%d",&tmp) != EOF) { ... (1 Reply)
Discussion started by: vincent__tse
1 Replies

10. Programming

problem with realloc( i think is gcc :/ )

Hi everyone, i made this program. is a simple one for practising malloc, realloc and structs. I have a struct named shop as global variable in which i take the size of the matrix from the keyboard and after i malloc it. I insert the values with the fullarray() and after i print the matrix with... (7 Replies)
Discussion started by: giampoul
7 Replies
PROCINFO-NG(8)                                                  Linux System Manual                                                 PROCINFO-NG(8)

NAME
procinfo - display system statistics gathered from /proc SYNOPSIS
procinfo [ -fdDSbrhv ] [ -nN ] DESCRIPTION
procinfo gathers some system data from the /proc directory and prints it nicely formatted on the standard output device. The meanings of the fields are as follows: Memory: See the man page for free(1) Bootup: The time the system was booted. Load average: The average number of jobs running, followed by the number of runnable processes and the total number of processes, followed by the PID of the last process run. The pid of the last running process will probably always be procinfo's PID. user: The amount of time spent running jobs in user space. nice: The amount of time spent running niced jobs in user space. system: The amount of time spent running in kernel space. Note: the time spent servicing interrupts is not counted by the kernel (and noth- ing that procinfo can do about it). idle: The amount of time spent doing nothing. uptime: The time that the system has been up. The above four should more or less add up to this one. page in: The number of disk blocks paged into core from disk. 1 block is equal to 1 kiB. page out: The number of disk blocks paged out of core to disk. This includes regular disk-writes. swap in: The number of memory pages paged in from swap. swap out: The number of memory pages paged out to swap. context: The number of context switches, either since bootup or per interval. Disk stats(hda, hdb, sda, sdb): The number of reads and writes made to disks, whether CD-ROM, hard-drive, or USB. Shows all disks if they either are an hdX or sdX, or if they have a non-zero read/write count. Interrupts: Number of interrupts serviced since boot, or per interval, listed per IRQ. OPTIONS
-nN Pause N second between updates. This option implies -f. It may contain a decimal point. The default is 5 seconds. When run by root with a pause of 0 seconds, the program will run at the highest possible priority level. -d For memory, CPU times, paging, swapping, disk, context and interrupt stats, display values per second rather than totals. This option implies -f. -D Same as -d, except that memory stats are displayed as totals. -S When running with -d or -D, always show values per second, even when running with -n N with N greater than one second. -b Display numbers of bytes rather than number of I/O requests. -r This option adds an extra line to the memory info showing 'real' free memory, just as free(1) does. The numbers produced assume that Buffers and Cache are disposable. -H Displays memory stats in 'Human' (base 1024) numbers (KiB, MiB, GiB), instead of implied KBytes. -h Print a brief help message. -v Print version info. INTERACTIVE COMMANDS
When running procinfo fullscreen, you can change its behaviour by pressing d, D, S, r and b, which toggle the flags that correspond to their same-named commandline-options. In addition you can press q which quits the program. FILES
/proc The proc file system. BUGS
All of these statistics are taken verbatim from the kernel, without any scaling. Any case where the kernel specifies that a particular field means something different from how it is documented in this man-page, the kernel always wins. Some features of the original procinfo were elided, as they were considered non-useful, especially as many of them don't change anymore, and have better utilities for listing/displaying them. SEE ALSO
free(1), uptime(1), w(1), init(8), proc(5). AUTHOR
Adam Schrotenboer <adam@tabris.net> v2.0 2007-05-05 PROCINFO-NG(8)
All times are GMT -4. The time now is 09:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy