---
name: "ACE_Shared_Memory_SV"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Shared_Memory_SV"
---

# ACE\_Shared\_Memory\_SV(3)

Shared memory wrapper based on System V shared memory.

## NAME

ACE\_Shared\_Memory\_SV -  Shared memory wrapper based on System V shared memory.

## SYNOPSIS

```
#include <ace/Shared_Memory_SV.h>
class ACE_Shared_Memory_SV : public ACE_Shared_Memory
{
  public:
    enum{ ACE_CREATE = IPC_CREAT, ACE_OPEN = 0 };
    ACE_Shared_Memory_SV (void);
    ACE_Shared_Memory_SV (
        key_t id,
        int length,
        int create = ACE_Shared_Memory_SV::ACE_OPEN,
        int perms = ACE_DEFAULT_FILE_PERMS,
        void *addr = 0,
        int flags = 0
        );
    int open (
        key_t id,
        int length,
        int create = ACE_Shared_Memory_SV::ACE_OPEN,
        int perms = ACE_DEFAULT_FILE_PERMS,
        void *addr = 0,
        int flags = 0
        );
    virtual int close (void);
    virtual int remove (void);
    virtual void *malloc (size_t = 0);
    virtual int free (void *p);
    virtual int get_segment_size (void) const;
    virtual ACE_HANDLE get_id (void) const;
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    ACE_SV_Shared_Memory shared_memory_;
};
```

## DESCRIPTION

This class provides a very simple-minded shared memory manager.  For more a powerful memory allocator please see ACE\_Malloc.

## Initialization and termination methods.

```
ACE_Shared_Memory_SV (void);
```

```
ACE_Shared_Memory_SV (
    key_t id,
    int length,
    int create = ACE_Shared_Memory_SV::ACE_OPEN,
    int perms = ACE_DEFAULT_FILE_PERMS,
    void *addr = 0,
    int flags = 0
    );
```

```
int open (
    key_t id,
    int length,
    int create = ACE_Shared_Memory_SV::ACE_OPEN,
    int perms = ACE_DEFAULT_FILE_PERMS,
    void *addr = 0,
    int flags = 0
    );
```

```
virtual int close (void);
```

Close down the shared memory segment.

```
virtual int remove (void);
```

Remove the underlying shared memory segment.

## Allocation and deallocation methods.

```
virtual void *malloc (size_t = 0);
```

Create a new chuck of memory containing size bytes.

```
virtual int free (void *p);
```

Free a chuck of memory allocated by ACE\_Shared\_Memory\_SV::malloc.

```
virtual int get_segment_size (void) const;
```

Return the size of the shared memory segment.

```
virtual ACE_HANDLE get_id (void) const;
```

Return the ID of the shared memory segment (i.e., a System V shared memory internal id).

```
void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace
