473,748 Members | 3,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

shared memory malloc library

Hello,

i need to manage a heap in shared memory.
Does anybody know about a portable (win32+mac+posi x) c implementation
for this.

Apr 24 '07 #1
21 8382
In article <11************ **********@o40g 2000prh.googleg roups.com>,
llothar <ll*****@web.de wrote:
>i need to manage a heap in shared memory.
Does anybody know about a portable (win32+mac+posi x) c implementation
for this.
I believe that the win32 interface for shared memory is different
than the posix interface, so as best I know, there is no
implementation that is portable between those three platforms.
There might be an implementation that has conditional coding for
those platforms. But shared memory is not part of standard C
and so is not really appropriate for comp.lang.c; you should ask
in OS-specific newsgroups.

--
"law -- it's a commodity"
-- Andrew Ryan (The Globe and Mail, 2005/11/26)
Apr 24 '07 #2
llothar wrote:
>
i need to manage a heap in shared memory. Does anybody know about
a portable (win32+mac+posi x) c implementation for this.
Simply use malloc. It is consistent over all C systems.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline.net

--
Posted via a free Usenet account from http://www.teranews.com

Apr 24 '07 #3
CBFalconer <cb********@yah oo.comwrites:
llothar wrote:
>i need to manage a heap in shared memory. Does anybody know about
a portable (win32+mac+posi x) c implementation for this.

Simply use malloc. It is consistent over all C systems.
Yes, but it doesn't handle "shared memory", whatever that is.
<OT>Presumabl y it refers to memory that's shared between processes;
standard C has no such concept.</OT>

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Apr 24 '07 #4
In article <46************ ***@yahoo.com>,
CBFalconer <cb********@mai neline.netwrote :
>i need to manage a heap in shared memory. Does anybody know about
a portable (win32+mac+posi x) c implementation for this.
>Simply use malloc. It is consistent over all C systems.
This is an unhelpful answer. malloc() knows nothing about shared
memory. As another poster pointed out, this can't be done in portable
C, but there may well be libraries with conditional code that work on
the systems in question.

Unix provides shared memory through the system V shm*() functions or
the more natural BSD mmap() function. No doubt win32 provides
something similar. To manage concurrent access to shared memory you
could use any of several synchronisation mechanisms, from atomic
test-and-set in shared memory to heavyweight semaphore system calls.

-- Richard

--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Apr 24 '07 #5
Keith Thompson wrote:
CBFalconer <cb********@yah oo.comwrites:
>llothar wrote:
>>i need to manage a heap in shared memory. Does anybody know
about a portable (win32+mac+posi x) c implementation for this.

Simply use malloc. It is consistent over all C systems.

Yes, but it doesn't handle "shared memory", whatever that is.
<OT>Presumabl y it refers to memory that's shared between
processes; standard C has no such concept.</OT>
However, it may do all that. You can also [OT] arrange a process
to manage the memory.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline.net

--
Posted via a free Usenet account from http://www.teranews.com

Apr 24 '07 #6
On 24 Apr 2007 08:00:28 -0700, llothar <ll*****@web.de wrote:
>i need to manage a heap in shared memory.
Does anybody know about a portable (win32+mac+posi x) c implementation
for this.
Maybe APR? http://apr.apache.org/docs/apr/1.2/group__apr__shm.html
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
Apr 25 '07 #7
I believe that the win32 interface for shared memory is different
than the posix interface, so as best I know, there is no
implementation that is portable between those three platforms.
There might be an implementation that has conditional coding for
those platforms.
Of couse i mean conditional coding.
But shared memory is not part of standard C
and so is not really appropriate for comp.lang.c; you should ask
in OS-specific newsgroups.
Yes. But it is not offtopic here because for me everything that has
to do with plain programming in C belongs here.

And this includes questions about existing libraries for a problem as
in does in
all other comp.lang.xxx newsgroups.

Apr 26 '07 #8
llothar wrote:
>
>>But shared memory is not part of standard C
and so is not really appropriate for comp.lang.c; you should ask
in OS-specific newsgroups.


Yes. But it is not offtopic here because for me everything that has
to do with plain programming in C belongs here.
Shared memory libraries aren't "plain C", they are very platform specific.
And this includes questions about existing libraries for a problem as
in does in
all other comp.lang.xxx newsgroups.
No, it doesn't. You'd get the same response down the hall in the C++ group.

Apart form topicality, you will get better platform specific answers in
a platform specific group, so for your benefit, try those.

--
Ian Collins.
Apr 26 '07 #9
llothar wrote:
>
.... snip ...
>
Yes. But it is not offtopic here because for me everything that
has to do with plain programming in C belongs here.

And this includes questions about existing libraries for a problem
as in does in all other comp.lang.xxx newsgroups.
Yes, it is off-topic here, because the content and implementation
of those other libraries is not presented, or is not in standard C.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline.net

--
Posted via a free Usenet account from http://www.teranews.com

Apr 26 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
4149
by: sbayeta | last post by:
Hi, I'd like to know who is responsible of memory recycling and defragmentation in a C/C++ program, assuming all the memory allocation/deallocation is done using malloc/free or new/delete. Thanks
12
5632
by: gc | last post by:
I am writing a function that given nx1 vector a and a nx1 b solves a system of equations f(a,c)=b for a nx1 c. While writing the function: 1] Should I allocate the memory for c within the function and return the allocated memory? something that leads to double *solve(const double *a,const double *b,int n) { double *c;
2
1385
by: Paulo da Silva | last post by:
Hi. I am writing a shared library to override some libc functions. I have the following questions: Ex. int XXX=0; void f() {++XXX; ...; --XXX;}
10
14051
by: eyh5 | last post by:
Hi, My C code (running on Soalris Unix) has some "segmentation fault" that I wish to use purify to do it. I poked around the web, and found some information about adding some lines in a Makefile file to use purify. However, my code is a rather simple single-source C program, and I didn't write a Makefile for it. I'm wondering if anybody can tell me which commands are to be entered at the Unix prompt to use purify. And, I don't know if...
2
3275
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres and arrays of pointers to them. I have gotten the program to compile with gcc on WinXP. If the file i read doesnt have alot of records, it runs thru. But once i add more, it dies. In this program i have 4 files setup to read. The
9
2464
by: Sundar | last post by:
Hi, i am trying to make an application that will require registering of quite a few dlls and execute. Now one of the first bottlenecks that my mentor refused is allocation of memory or the usage of mallocs in the dlls. He tells me that for an application to run perfectly , there must be no dynamic memory in the libraries.. I am not quite impressed.. Can anyone clear out this mess please?
2
4491
by: oopsatwork | last post by:
Ok...so, I have been outside of the C world for a _very_ long time...but not so long as to remember how to do multidimensional arrays. So, let me state that I know how to malloc pointers to pointers and then malloc my data space. This question is NOT about that. I need to keep a dynamically sized (a result of command line options) matrix in a shared memory segment created via shmget and attached via shmat. My first instinct was to do...
2
2629
by: S S | last post by:
Hi I have my shared (.so) library which uses our own memory manager. 32 bit lib was working fine, but when we switched to 64 bit library, as our own defined small pointer can not handle big addresses. I am facing trouble as our memory manager do not handle big memory requests but passes it on to system malloc() and malloc returns out of range addresses which our small pointer can not accommodate. Whole of the design is based on that...
3
3231
by: S S | last post by:
Hi Are there some known issues using STL with shared library. Recently I got some crash for which the reason I dont see any, and searching on goolge shown some such issues with shared library. If somebody can help ? Thanks in advance. S
0
8989
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.