Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 |
|
---|
8 | namespace DistributedGA.Core.Util {
|
---|
9 | public class ByteArrayWrapper {
|
---|
10 | public static int AliveCounter;
|
---|
11 | public static int AllocatedCounter;
|
---|
12 | public static int FreedCounter;
|
---|
13 |
|
---|
14 | public static ByteArrayWrapper CreateByteArrayWrapper(byte[] arr) {
|
---|
15 | return new ByteArrayWrapper(arr);
|
---|
16 | }
|
---|
17 |
|
---|
18 | public byte[] Array { get; private set; }
|
---|
19 |
|
---|
20 | private ByteArrayWrapper(byte[] arr) {
|
---|
21 | Interlocked.Increment(ref AliveCounter);
|
---|
22 | Interlocked.Increment(ref AllocatedCounter);
|
---|
23 | this.Array = arr;
|
---|
24 | }
|
---|
25 |
|
---|
26 | ~ByteArrayWrapper() {
|
---|
27 | Interlocked.Decrement(ref AliveCounter);
|
---|
28 | Interlocked.Increment(ref FreedCounter);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.