~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_instrument.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
typedef struct {
31
31
    Uint size;
 
32
#ifdef VALGRIND
 
33
    void* valgrind_leak_suppressor;
 
34
#endif
32
35
    Align_t mem[1];
33
36
} StatBlock_t;
34
37
 
281
284
    if (res) {
282
285
        stat_upd_alloc(n, size);
283
286
        ((StatBlock_t *) res)->size = size;
 
287
#ifdef VALGRIND
 
288
        /* Suppress "possibly leaks" by storing an actual dummy pointer
 
289
           to the _start_ of the allocated block.*/
 
290
        ((StatBlock_t *) res)->valgrind_leak_suppressor = res;
 
291
#endif
284
292
        res = (void *) ((StatBlock_t *) res)->mem;
285
293
    }
286
294
 
314
322
    if (res) {
315
323
        stat_upd_realloc(n, size, old_size);
316
324
        ((StatBlock_t *) res)->size = size;
 
325
#ifdef VALGRIND
 
326
        ((StatBlock_t *) res)->valgrind_leak_suppressor = res;
 
327
#endif
317
328
        res = (void *) ((StatBlock_t *) res)->mem;
318
329
    }
319
330