Coverage Report

Created: 2026-01-10 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dng_sdk/source/dng_memory.h
Line
Count
Source
1
/*****************************************************************************/
2
// Copyright 2006-2007 Adobe Systems Incorporated
3
// All Rights Reserved.
4
//
5
// NOTICE:  Adobe permits you to use, modify, and distribute this file in
6
// accordance with the terms of the Adobe license agreement accompanying it.
7
/*****************************************************************************/
8
9
/* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_memory.h#1 $ */ 
10
/* $DateTime: 2012/05/30 13:28:51 $ */
11
/* $Change: 832332 $ */
12
/* $Author: tknoll $ */
13
14
/** Support for memory allocation.
15
 */
16
17
/*****************************************************************************/
18
19
#ifndef __dng_memory__
20
#define __dng_memory__
21
22
/*****************************************************************************/
23
24
#include "dng_classes.h"
25
#include "dng_exceptions.h"
26
#include "dng_safe_arithmetic.h"
27
#include "dng_types.h"
28
29
#include <cstdlib>
30
#include <vector>
31
32
/*****************************************************************************/
33
34
/// \brief Class to provide resource acquisition is instantiation discipline
35
/// for small memory allocations.
36
///
37
/// This class does not use dng_memory_allocator for memory allocation.
38
39
class dng_memory_data
40
  {
41
  
42
  private:
43
  
44
    char *fBuffer;
45
    
46
  public:
47
  
48
    /// Construct an empty memory buffer using malloc.
49
    /// \exception dng_memory_full with fErrorCode equal to dng_error_memory.
50
51
    dng_memory_data ();
52
    
53
    /// Construct memory buffer of size bytes using malloc.
54
    /// \param size Number of bytes of memory needed.
55
    /// \exception dng_memory_full with fErrorCode equal to dng_error_memory.
56
57
    dng_memory_data (uint32 size);
58
    
59
    /// Note: This constructor is for internal use only and should not be
60
    /// considered part of the DNG SDK API.
61
    ///
62
    /// Construct memory buffer of count elements of elementSize bytes each.
63
    /// \param count Number of elements.
64
    /// \param elementSize Size of each element.
65
    /// \exception dng_memory_full with fErrorCode equal to dng_error_memory.
66
    dng_memory_data (uint32 count, std::size_t elementSize);
67
68
    /// Release memory buffer using free.
69
70
    ~dng_memory_data ();
71
72
    /// Clear existing memory buffer and allocate new memory of size bytes.
73
    /// \param size Number of bytes of memory needed.
74
    /// \exception dng_memory_full with fErrorCode equal to dng_error_memory.
75
76
    void Allocate (uint32 size);
77
78
    /// Note: This method is for internal use only and should not be
79
    /// considered part of the DNG SDK API.
80
    ///
81
    /// Clear existing memory buffer and allocate new memory of count
82
    /// elements of elementSize bytes each.
83
    /// \param count Number of elements.
84
    /// \param elementSize Size of each element.
85
    /// \exception dng_memory_full with fErrorCode equal to dng_error_memory.
86
    void Allocate (uint32 count, std::size_t elementSize);
87
88
    /// Release any allocated memory using free. Object is still valid and
89
    /// Allocate can be called again.
90
    
91
    void Clear ();
92
    
93
    /// Return pointer to allocated memory as a void *..
94
    /// \retval void * valid for as many bytes as were allocated.
95
96
    void * Buffer ()
97
2.46M
      {
98
2.46M
      return fBuffer;
99
2.46M
      }
100
    
101
    /// Return pointer to allocated memory as a const void *.
102
    /// \retval const void * valid for as many bytes as were allocated.
103
104
    const void * Buffer () const
105
13.1M
      {
106
13.1M
      return fBuffer;
107
13.1M
      }
108
    
109
    /// Return pointer to allocated memory as a char *.
110
    /// \retval char * valid for as many bytes as were allocated.
111
112
    char * Buffer_char ()
113
1.66M
      {
114
1.66M
      return (char *) Buffer ();
115
1.66M
      }
116
      
117
    /// Return pointer to allocated memory as a const char *.
118
    /// \retval const char * valid for as many bytes as were allocated.
119
120
    const char * Buffer_char () const
121
1.28M
      {
122
1.28M
      return (const char *) Buffer ();
123
1.28M
      }
124
      
125
    /// Return pointer to allocated memory as a uint8 *.
126
    /// \retval uint8 * valid for as many bytes as were allocated.
127
128
    uint8 * Buffer_uint8 ()
129
348k
      {
130
348k
      return (uint8 *) Buffer ();
131
348k
      }
132
      
133
    /// Return pointer to allocated memory as a const uint8 *.
134
    /// \retval const uint8 * valid for as many bytes as were allocated.
135
136
    const uint8 * Buffer_uint8 () const
137
0
      {
138
0
      return (const uint8 *) Buffer ();
139
0
      }
140
  
141
    /// Return pointer to allocated memory as a uint16 *.
142
    /// \retval uint16 * valid for as many bytes as were allocated.
143
144
    uint16 * Buffer_uint16 ()
145
4.31k
      {
146
4.31k
      return (uint16 *) Buffer ();
147
4.31k
      }
148
      
149
    /// Return pointer to allocated memory as a const uint16 *.
150
    /// \retval const uint16 * valid for as many bytes as were allocated.
151
152
    const uint16 * Buffer_uint16 () const
153
67.5k
      {
154
67.5k
      return (const uint16 *) Buffer ();
155
67.5k
      }
156
  
157
    /// Return pointer to allocated memory as a int16 *.
158
    /// \retval int16 * valid for as many bytes as were allocated.
159
160
    int16 * Buffer_int16 ()
161
0
      {
162
0
      return (int16 *) Buffer ();
163
0
      }
164
      
165
    /// Return pointer to allocated memory as a const int16 *.
166
    /// \retval const int16 * valid for as many bytes as were allocated.
167
168
    const int16 * Buffer_int16 () const
169
0
      {
170
0
      return (const int16 *) Buffer ();
171
0
      }
172
  
173
    /// Return pointer to allocated memory as a uint32 *.
174
    /// \retval uint32 * valid for as many bytes as were allocated.
175
176
    uint32 * Buffer_uint32 ()
177
117k
      {
178
117k
      return (uint32 *) Buffer ();
179
117k
      }
180
      
181
    /// Return pointer to allocated memory as a uint32 *.
182
    /// \retval uint32 * valid for as many bytes as were allocated.
183
184
    const uint32 * Buffer_uint32 () const
185
0
      {
186
0
      return (const uint32 *) Buffer ();
187
0
      }
188
  
189
    /// Return pointer to allocated memory as a const int32 *.
190
    /// \retval const int32 * valid for as many bytes as were allocated.
191
192
    int32 * Buffer_int32 ()
193
0
      {
194
0
      return (int32 *) Buffer ();
195
0
      }
196
      
197
    /// Return pointer to allocated memory as a const int32 *.
198
    /// \retval const int32 * valid for as many bytes as were allocated.
199
200
    const int32 * Buffer_int32 () const
201
0
      {
202
0
      return (const int32 *) Buffer ();
203
0
      }
204
  
205
    /// Return pointer to allocated memory as a uint64 *.
206
    /// \retval uint64 * valid for as many bytes as were allocated.
207
208
    uint64 * Buffer_uint64 ()
209
30.4k
      {
210
30.4k
      return (uint64 *) Buffer ();
211
30.4k
      }
212
      
213
    /// Return pointer to allocated memory as a uint64 *.
214
    /// \retval uint64 * valid for as many bytes as were allocated.
215
216
    const uint64 * Buffer_uint64 () const
217
0
      {
218
0
      return (const uint64 *) Buffer ();
219
0
      }
220
  
221
    /// Return pointer to allocated memory as a const int64 *.
222
    /// \retval const int64 * valid for as many bytes as were allocated.
223
224
    int64 * Buffer_int64 ()
225
0
      {
226
0
      return (int64 *) Buffer ();
227
0
      }
228
      
229
    /// Return pointer to allocated memory as a const int64 *.
230
    /// \retval const int64 * valid for as many bytes as were allocated.
231
232
    const int64 * Buffer_int64 () const
233
0
      {
234
0
      return (const int64 *) Buffer ();
235
0
      }
236
  
237
    /// Return pointer to allocated memory as a real32 *.
238
    /// \retval real32 * valid for as many bytes as were allocated.
239
240
    real32 * Buffer_real32 ()
241
14.1k
      {
242
14.1k
      return (real32 *) Buffer ();
243
14.1k
      }
244
      
245
    /// Return pointer to allocated memory as a const real32 *.
246
    /// \retval const real32 * valid for as many bytes as were allocated.
247
248
    const real32 * Buffer_real32 () const
249
0
      {
250
0
      return (const real32 *) Buffer ();
251
0
      }
252
      
253
    /// Return pointer to allocated memory as a real64 *.
254
    /// \retval real64 * valid for as many bytes as were allocated.
255
256
    real64 * Buffer_real64 ()
257
0
      {
258
0
      return (real64 *) Buffer ();
259
0
      }
260
      
261
    /// Return pointer to allocated memory as a const real64 *.
262
    /// \retval const real64 * valid for as many bytes as were allocated.
263
264
    const real64 * Buffer_real64 () const
265
0
      {
266
0
      return (const real64 *) Buffer ();
267
0
      }
268
      
269
  private:
270
  
271
    // Hidden copy constructor and assignment operator.
272
  
273
    dng_memory_data (const dng_memory_data &data);
274
    
275
    dng_memory_data & operator= (const dng_memory_data &data);
276
277
  };
278
  
279
/*****************************************************************************/
280
281
/// \brief Class to provide resource acquisition is instantiation discipline for
282
/// image buffers and other larger memory allocations.
283
///
284
/// This class requires a dng_memory_allocator for allocation.
285
286
class dng_memory_block
287
  {
288
  
289
  private:
290
  
291
    uint32 fLogicalSize;
292
    
293
    char *fBuffer;
294
    
295
  protected:
296
  
297
    dng_memory_block (uint32 logicalSize)
298
536k
      : fLogicalSize (logicalSize)
299
536k
      , fBuffer (NULL)
300
536k
      {
301
536k
      }
302
    
303
    uint32 PhysicalSize ()
304
536k
      {
305
      
306
      // This size is padded for TWO reasons!  The first is allow alignment
307
      // to 16-byte boundaries if the allocator does not do that already.  The
308
      // second, which is very important, so to provide safe overread areas for
309
      // SSE2-type bottlenecks, which can often be written faster by allowing them
310
      // to reading slightly block.  Someone on the image core them did not
311
      // understand this and removed this padding.  I'm undoing this removal
312
      // and restoring this padding, since removing it might lead to memory
313
      // access crashes in some cases.
314
315
      // This padding is throwing off all of our allocations (f.e. dng_string, pixel buffers, etc)
316
      //  that uses dng_memory_block on iOS/Android that is memory limited.  Imagecore carefully
317
      //  allocates pow2 tile buffers, but this bumps us to the next ssd block (+4K).  
318
      // This also makes it difficult to identify memory reports in Instruments since all 
319
      //  numbers are off by 64.  Imagecore never crashed from the removal of the padding.  
320
      // The allocator on Win64/Mac64 is 16-byte aligned already. iOS is too.  
321
      //  Linux is 8 byte, but it's using mem_align.  
322
      // We should fix the SIMD routines and revisit removing this padding - Alec.
323
      
324
536k
      uint32 result;
325
536k
      if (!SafeUint32Add(fLogicalSize, 64u, &result))
326
439
        {
327
439
        ThrowMemoryFull("Arithmetic overflow in PhysicalSize()");
328
439
        }
329
      
330
536k
      return result;
331
      
332
536k
      }
333
    
334
    void SetBuffer (void *p)
335
536k
      {
336
536k
      fBuffer = (char *) ((((uintptr) p) + 15) & ~((uintptr) 15));
337
536k
      }
338
    
339
  public:
340
  
341
    virtual ~dng_memory_block ()
342
536k
      {
343
536k
      }
344
345
    dng_memory_block * Clone (dng_memory_allocator &allocator) const;
346
  
347
    /// Getter for available size, in bytes, of memory block.
348
    /// \retval size in bytes of available memory in memory block.
349
350
    uint32 LogicalSize () const
351
232k
      {
352
232k
      return fLogicalSize;
353
232k
      }
354
355
    /// Return pointer to allocated memory as a void *..
356
    /// \retval void * valid for as many bytes as were allocated.
357
358
    void * Buffer ()
359
991M
      {
360
991M
      return fBuffer;
361
991M
      }
362
    
363
    /// Return pointer to allocated memory as a const void *.
364
    /// \retval const void * valid for as many bytes as were allocated.
365
366
    const void * Buffer () const
367
158
      {
368
158
      return fBuffer;
369
158
      }
370
    
371
    /// Return pointer to allocated memory as a char *.
372
    /// \retval char * valid for as many bytes as were allocated.
373
374
    char * Buffer_char ()
375
0
      {
376
0
      return (char *) Buffer ();
377
0
      }
378
      
379
    /// Return pointer to allocated memory as a const char *.
380
    /// \retval const char * valid for as many bytes as were allocated.
381
382
    const char * Buffer_char () const
383
0
      {
384
0
      return (const char *) Buffer ();
385
0
      }
386
      
387
    /// Return pointer to allocated memory as a uint8 *.
388
    /// \retval uint8 * valid for as many bytes as were allocated.
389
390
    uint8 * Buffer_uint8 ()
391
5.44M
      {
392
5.44M
      return (uint8 *) Buffer ();
393
5.44M
      }
394
      
395
    /// Return pointer to allocated memory as a const uint8 *.
396
    /// \retval const uint8 * valid for as many bytes as were allocated.
397
398
    const uint8 * Buffer_uint8 () const
399
0
      {
400
0
      return (const uint8 *) Buffer ();
401
0
      }
402
  
403
    /// Return pointer to allocated memory as a uint16 *.
404
    /// \retval uint16 * valid for as many bytes as were allocated.
405
406
    uint16 * Buffer_uint16 ()
407
817M
      {
408
817M
      return (uint16 *) Buffer ();
409
817M
      }
410
      
411
    /// Return pointer to allocated memory as a const uint16 *.
412
    /// \retval const uint16 * valid for as many bytes as were allocated.
413
414
    const uint16 * Buffer_uint16 () const
415
0
      {
416
0
      return (const uint16 *) Buffer ();
417
0
      }
418
  
419
    /// Return pointer to allocated memory as a int16 *.
420
    /// \retval int16 * valid for as many bytes as were allocated.
421
422
    int16 * Buffer_int16 ()
423
34.0M
      {
424
34.0M
      return (int16 *) Buffer ();
425
34.0M
      }
426
      
427
    /// Return pointer to allocated memory as a const int16 *.
428
    /// \retval const int16 * valid for as many bytes as were allocated.
429
430
    const int16 * Buffer_int16 () const
431
0
      {
432
0
      return (const int16 *) Buffer ();
433
0
      }
434
  
435
    /// Return pointer to allocated memory as a uint32 *.
436
    /// \retval uint32 * valid for as many bytes as were allocated.
437
438
    uint32 * Buffer_uint32 ()
439
5.04k
      {
440
5.04k
      return (uint32 *) Buffer ();
441
5.04k
      }
442
      
443
    /// Return pointer to allocated memory as a const uint32 *.
444
    /// \retval const uint32 * valid for as many bytes as were allocated.
445
446
    const uint32 * Buffer_uint32 () const
447
0
      {
448
0
      return (const uint32 *) Buffer ();
449
0
      }
450
  
451
    /// Return pointer to allocated memory as a int32 *.
452
    /// \retval int32 * valid for as many bytes as were allocated.
453
454
    int32 * Buffer_int32 ()
455
110M
      {
456
110M
      return (int32 *) Buffer ();
457
110M
      }
458
      
459
    /// Return pointer to allocated memory as a const int32 *.
460
    /// \retval const int32 * valid for as many bytes as were allocated.
461
462
    const int32 * Buffer_int32 () const
463
0
      {
464
0
      return (const int32 *) Buffer ();
465
0
      }
466
  
467
    /// Return pointer to allocated memory as a real32 *.
468
    /// \retval real32 * valid for as many bytes as were allocated.
469
470
    real32 * Buffer_real32 ()
471
18.4M
      {
472
18.4M
      return (real32 *) Buffer ();
473
18.4M
      }
474
      
475
    /// Return pointer to allocated memory as a const real32 *.
476
    /// \retval const real32 * valid for as many bytes as were allocated.
477
478
    const real32 * Buffer_real32 () const
479
0
      {
480
0
      return (const real32 *) Buffer ();
481
0
      }
482
      
483
    /// Return pointer to allocated memory as a real64 *.
484
    /// \retval real64 * valid for as many bytes as were allocated.
485
486
    real64 * Buffer_real64 ()
487
745k
      {
488
745k
      return (real64 *) Buffer ();
489
745k
      }
490
      
491
    /// Return pointer to allocated memory as a const real64 *.
492
    /// \retval const real64 * valid for as many bytes as were allocated.
493
494
    const real64 * Buffer_real64 () const
495
0
      {
496
0
      return (const real64 *) Buffer ();
497
0
      }
498
499
  private:
500
  
501
    // Hidden copy constructor and assignment operator.
502
  
503
    dng_memory_block (const dng_memory_block &data);
504
    
505
    dng_memory_block & operator= (const dng_memory_block &data);
506
507
  };
508
509
/*****************************************************************************/
510
511
/// \brief Interface for dng_memory_block allocator.
512
513
class dng_memory_allocator
514
  {
515
  
516
  public:
517
  
518
    virtual ~dng_memory_allocator () 
519
0
      {
520
0
      }
521
        
522
    /// Allocate a dng_memory block.
523
    /// \param size Number of bytes in memory block.
524
    /// \retval A dng_memory_block with at least size bytes of valid storage.
525
    /// \exception dng_exception with fErrorCode equal to dng_error_memory.
526
527
    virtual dng_memory_block * Allocate (uint32 size);
528
  
529
  };
530
531
/*****************************************************************************/
532
533
/// \brief Default memory allocator used if NULL is passed in for allocator 
534
/// when constructing a dng_host.
535
///
536
/// Uses new and delete for memory block object and malloc/free for underlying
537
/// buffer. 
538
539
extern dng_memory_allocator gDefaultDNGMemoryAllocator;
540
541
/*****************************************************************************/
542
543
// C++ allocator (i.e. an implementation of the Allocator concept) that throws a
544
// dng_exception with error code dng_error_memory if it cannot allocate memory.
545
template <typename T>
546
class dng_std_allocator
547
  {
548
  
549
  public:
550
    typedef T value_type;
551
    
552
    // Default implementations of default constructor and copy constructor.
553
    dng_std_allocator () = default;
554
    dng_std_allocator (const dng_std_allocator&) = default;
555
    template<typename U> dng_std_allocator (const dng_std_allocator<U>&) {}
556
    
557
    T* allocate (size_t n)
558
335k
      {
559
335k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
335k
      T *retval = static_cast<T *> (malloc (size));
561
335k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
335k
      return retval;
565
335k
      }
dng_std_allocator<dng_noise_function>::allocate(unsigned long)
Line
Count
Source
558
8.88k
      {
559
8.88k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
8.88k
      T *retval = static_cast<T *> (malloc (size));
561
8.88k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
8.88k
      return retval;
565
8.88k
      }
dng_std_allocator<unsigned int>::allocate(unsigned long)
Line
Count
Source
558
3.72k
      {
559
3.72k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
3.72k
      T *retval = static_cast<T *> (malloc (size));
561
3.72k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
3.72k
      return retval;
565
3.72k
      }
dng_std_allocator<dng_point_real64>::allocate(unsigned long)
Line
Count
Source
558
174k
      {
559
174k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
174k
      T *retval = static_cast<T *> (malloc (size));
561
174k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
174k
      return retval;
565
174k
      }
dng_std_allocator<double>::allocate(unsigned long)
Line
Count
Source
558
940
      {
559
940
      const size_t size = SafeSizetMult(n, sizeof (T));
560
940
      T *retval = static_cast<T *> (malloc (size));
561
940
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
940
      return retval;
565
940
      }
dng_std_allocator<dng_fingerprint>::allocate(unsigned long)
Line
Count
Source
558
14.5k
      {
559
14.5k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
14.5k
      T *retval = static_cast<T *> (malloc (size));
561
14.5k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
14.5k
      return retval;
565
14.5k
      }
dng_std_allocator<dng_camera_profile*>::allocate(unsigned long)
Line
Count
Source
558
38.2k
      {
559
38.2k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
38.2k
      T *retval = static_cast<T *> (malloc (size));
561
38.2k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
38.2k
      return retval;
565
38.2k
      }
dng_std_allocator<dng_opcode*>::allocate(unsigned long)
Line
Count
Source
558
22.1k
      {
559
22.1k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
22.1k
      T *retval = static_cast<T *> (malloc (size));
561
22.1k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
22.1k
      return retval;
565
22.1k
      }
dng_std_allocator<AutoPtr<dng_memory_block> >::allocate(unsigned long)
Line
Count
Source
558
4.25k
      {
559
4.25k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
4.25k
      T *retval = static_cast<T *> (malloc (size));
561
4.25k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
4.25k
      return retval;
565
4.25k
      }
dng_std_allocator<dng_camera_profile_info>::allocate(unsigned long)
Line
Count
Source
558
7.40k
      {
559
7.40k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
7.40k
      T *retval = static_cast<T *> (malloc (size));
561
7.40k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
7.40k
      return retval;
565
7.40k
      }
dng_std_allocator<dng_point>::allocate(unsigned long)
Line
Count
Source
558
32.8k
      {
559
32.8k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
32.8k
      T *retval = static_cast<T *> (malloc (size));
561
32.8k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
32.8k
      return retval;
565
32.8k
      }
dng_std_allocator<dng_rect>::allocate(unsigned long)
Line
Count
Source
558
28.4k
      {
559
28.4k
      const size_t size = SafeSizetMult(n, sizeof (T));
560
28.4k
      T *retval = static_cast<T *> (malloc (size));
561
28.4k
      if (!retval) {
562
0
        ThrowMemoryFull ();
563
0
      }
564
28.4k
      return retval;
565
28.4k
      }
566
    
567
    void deallocate (T *ptr, size_t n)
568
335k
      {
569
335k
      free (ptr);
570
335k
      }
dng_std_allocator<dng_noise_function>::deallocate(dng_noise_function*, unsigned long)
Line
Count
Source
568
8.88k
      {
569
8.88k
      free (ptr);
570
8.88k
      }
dng_std_allocator<unsigned int>::deallocate(unsigned int*, unsigned long)
Line
Count
Source
568
3.72k
      {
569
3.72k
      free (ptr);
570
3.72k
      }
dng_std_allocator<dng_point_real64>::deallocate(dng_point_real64*, unsigned long)
Line
Count
Source
568
174k
      {
569
174k
      free (ptr);
570
174k
      }
dng_std_allocator<double>::deallocate(double*, unsigned long)
Line
Count
Source
568
940
      {
569
940
      free (ptr);
570
940
      }
dng_std_allocator<dng_fingerprint>::deallocate(dng_fingerprint*, unsigned long)
Line
Count
Source
568
14.5k
      {
569
14.5k
      free (ptr);
570
14.5k
      }
dng_std_allocator<dng_camera_profile*>::deallocate(dng_camera_profile**, unsigned long)
Line
Count
Source
568
38.2k
      {
569
38.2k
      free (ptr);
570
38.2k
      }
dng_std_allocator<AutoPtr<dng_memory_block> >::deallocate(AutoPtr<dng_memory_block>*, unsigned long)
Line
Count
Source
568
4.25k
      {
569
4.25k
      free (ptr);
570
4.25k
      }
dng_std_allocator<dng_opcode*>::deallocate(dng_opcode**, unsigned long)
Line
Count
Source
568
22.1k
      {
569
22.1k
      free (ptr);
570
22.1k
      }
dng_std_allocator<dng_camera_profile_info>::deallocate(dng_camera_profile_info*, unsigned long)
Line
Count
Source
568
7.40k
      {
569
7.40k
      free (ptr);
570
7.40k
      }
dng_std_allocator<dng_point>::deallocate(dng_point*, unsigned long)
Line
Count
Source
568
32.8k
      {
569
32.8k
      free (ptr);
570
32.8k
      }
dng_std_allocator<dng_rect>::deallocate(dng_rect*, unsigned long)
Line
Count
Source
568
28.4k
      {
569
28.4k
      free (ptr);
570
28.4k
      }
571
};
572
573
template <class T>
574
bool operator== (const dng_std_allocator<T> &a1,
575
         const dng_std_allocator<T> &a2)
576
  {
577
  return true;
578
  }
579
580
template <class T>
581
bool operator!= (const dng_std_allocator<T> &a1,
582
         const dng_std_allocator<T> &a2)
583
2.50k
  {
584
2.50k
  return false;
585
2.50k
  }
bool operator!=<double>(dng_std_allocator<double> const&, dng_std_allocator<double> const&)
Line
Count
Source
583
160
  {
584
160
  return false;
585
160
  }
bool operator!=<dng_noise_function>(dng_std_allocator<dng_noise_function> const&, dng_std_allocator<dng_noise_function> const&)
Line
Count
Source
583
2.34k
  {
584
2.34k
  return false;
585
2.34k
  }
586
587
// std::vector specialized to use dng_std_allocator for allocation.
588
template <class T> using dng_std_vector = std::vector<T, dng_std_allocator<T> >;
589
590
/*****************************************************************************/
591
592
#endif
593
  
594
/*****************************************************************************/