mono_image_close_all (image->modules, image->module_count);
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (image->mempool);
+ /* FIXME: use an explicit subtraction method as soon as it's available */
+ InterlockedAdd (&mono_perfcounters->loader_bytes, -1 * mono_mempool_get_allocated (image->mempool));
#endif
if (!image_is_dynamic (image)) {
gpointer res;
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->loader_bytes += size;
+ InterlockedAdd (&mono_perfcounters->loader_bytes, size);
#endif
mono_image_lock (image);
res = mono_mempool_alloc (image->mempool, size);
gpointer res;
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->loader_bytes += size;
+ InterlockedAdd (&mono_perfcounters->loader_bytes, size);
#endif
mono_image_lock (image);
res = mono_mempool_alloc0 (image->mempool, size);
char *res;
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->loader_bytes += strlen (s);
+ InterlockedAdd (&mono_perfcounters->loader_bytes, strlen (s));
#endif
mono_image_lock (image);
res = mono_mempool_strdup (image->mempool, s);
buf = mono_mempool_strdup_vprintf (image->mempool, format, args);
mono_image_unlock (image);
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->loader_bytes += strlen (buf);
+ InterlockedAdd (&mono_perfcounters->loader_bytes, strlen (buf));
#endif
return buf;
}