01-24-2002
Sharing C++ Objects with virtual function table pointers
I am pondering the next question:
Can I safely sare objects that have virtual functions (i.e. have
virtual function table pointers) between two processes ?
Where will the pointers point to in each process ?
What I am afraid of is that in the creating process the pointer
will indeed point to the virtual function table, but in the
sharing process that pointer will point at junk.
Can anyone calm me or maybe confirm my fears ?
Thank you !
10 More Discussions You Might Find Interesting
1. Programming
HI,
Here is some thing that is puzzling me from a long time.
Can some body explain me this with example.
The question is :-
What is the difference between function pointer and pointer to a function.
Where do we actually use the function pointers and pointer to functions.
Thanks in... (0 Replies)
Discussion started by: S.Vishwanath
0 Replies
2. IP Networking
I have RedHat 9.0 installed on three of my servers (PIII - 233MHz) and want that they share a common IP address so that any request made reaches each of the servers.
Can anyone suggest how should I setup my LAN. I'm new to networking in Linux so please elaborate and would be thankful for a timely... (2 Replies)
Discussion started by: Rakesh Ranjan
2 Replies
3. Programming
Dear All,
Here I want to know why we put =0 in case of pure virtual function, why not =1, =2 or any thing else
Please send me answer any one as soon as possible. (1 Reply)
Discussion started by: krishna_sicsr
1 Replies
4. OS X (Apple)
Hi,
I'm trying to create a virtual screen, (maybe xvfb? or any other virtual screen buffer) and be able to use Screen Sharing to connect to it.
The setup is that I have a Mac Mini connected to the TV. But when my girlfriend is using Front Row, I can't use Screen Sharing at the same time from... (0 Replies)
Discussion started by: linge
0 Replies
5. Shell Programming and Scripting
What I am trying to achieve is turning crosstab into a normal table
e.g.
convert following table
Jan Feb Mar Apr May Jun
Australia 1 2 3 4 5 6
USA 7 8 9 10 11 12
China 13 14 15 16 17 18
to
Australia Jan 1
Australia Feb 2
Australia Mar 3 ... (2 Replies)
Discussion started by: asdban
2 Replies
6. Shell Programming and Scripting
Hi
I am new to Unix shell scripting. But i need help to slove the below issue.
Issue description:
I want to read table, view names and package names in a file
my plan to find the table name is : search "From" key word find the table or view
To find the packge name : Search "Package... (5 Replies)
Discussion started by: sboss
5 Replies
7. Programming
Hello forum memebers
As iam new to C++ programming i am little bit confuse to understand the function pointers.
Please help me to understand the function pointers with examples are suggest me good site for this,Its better if it have picturial representation ie any PPTS available in Google.... (2 Replies)
Discussion started by: rajkumar_g
2 Replies
8. UNIX for Advanced & Expert Users
I want address of current virtual memory block?
i am using fedora10:wall::wall: (1 Reply)
Discussion started by: powyama
1 Replies
9. Programming
I am attempting to create an array of function pointers. The examples I follow to do this are from:
support.microsoft.com/en-us/help/30580/how-to-declare-an-array-of-pointers-to-functions-in-visual-c
... (3 Replies)
Discussion started by: spflanze
3 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
Is there any way I can prioritize my VMs when there is resource crunch in host machine so that some VMs will be allocated more vcpu, more memory than other VMs in kvm/qemu hypervisor based virtual machines?
Lets say in my cloud environment my Ubuntu 16 compute hosts are running some... (0 Replies)
Discussion started by: SanjayK
0 Replies
LEARN ABOUT REDHAT
mremap
MREMAP(2) Linux Programmer's Manual MREMAP(2)
NAME
mremap - re-map a virtual memory address
SYNOPSIS
#include <unistd.h>
#include <sys/mman.h>
void * mremap(void *old_address, size_t old_size , size_t new_size, unsigned long flags);
DESCRIPTION
mremap expands (or shrinks) an existing memory mapping, potentially moving it at the same time (controlled by the flags argument and the
available virtual address space).
old_address is the old address of the virtual memory block that you want to expand (or shrink). Note that old_address has to be page
aligned. old_size is the old size of the virtual memory block. new_size is the requested size of the virtual memory block after the
resize.
The flags argument is a bitmap of flags.
In Linux the memory is divided into pages. A user process has (one or) several linear virtual memory segments. Each virtual memory seg-
ment has one or more mappings to real memory pages (in the page table). Each virtual memory segment has its own protection (access
rights), which may cause a segmentation violation if the memory is accessed incorrectly (e.g., writing to a read-only segment). Accessing
virtual memory outside of the segments will also cause a segmentation violation.
mremap uses the Linux page table scheme. mremap changes the mapping between virtual addresses and memory pages. This can be used to
implement a very efficient realloc.
FLAGS
MREMAP_MAYMOVE
indicates if the operation should fail, or change the virtual address if the resize cannot be done at the current virtual address.
RETURN VALUE
On success mremap returns a pointer to the new virtual memory area. On error, -1 is returned, and errno is set appropriately.
ERRORS
EINVAL An invalid argument was given. Most likely old_address was not page aligned.
EFAULT "Segmentation fault." Some address in the range old_address to old_address+old_size is an invalid virtual memory address for this
process. You can also get EFAULT even if there exist mappings that cover the whole address space requested, but those mappings are
of different types.
EAGAIN The memory segment is locked and cannot be re-mapped.
ENOMEM The memory area cannot be expanded at the current virtual address, and the MREMAP_MAYMOVE flag is not set in flags. Or, there is
not enough (virtual) memory available.
NOTES
With current glibc includes, in order to get the definition of MREMAP_MAYMOVE, you need to define _GNU_SOURCE before including
<sys/mman.h>.
CONFORMING TO
This call is Linux-specific, and should not be used in programs intended to be portable. 4.2BSD had a (never actually implemented)
mremap(2) call with completely different semantics.
SEE ALSO
getpagesize(2), realloc(3), malloc(3), brk(2), sbrk(2), mmap(2)
Your favorite OS text book for more information on paged memory. (Modern Operating Systems by Andrew S. Tannenbaum, Inside Linux by Ran-
dolf Bentson, The Design of the UNIX Operating System by Maurice J. Bach.)
Linux 1.3.87 1996-04-12 MREMAP(2)