Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

NPN_MemFlush

This article needs a technical review. How you can help.

« Gecko Plugin API Reference « Plug-in Side Plug-in API

Summary

Note: This function is only implemented on Mac OS X.

Requests that the browser free a specified amount of memory.

Syntax

#include <npapi.h>
 
uint32 NPN_MemFlush(uint32 size);

Parameters

The function has the following parameters:

size
Size of memory, in bytes, to free in the browser's memory space.

Returns

  • If successful, the function returns the amount of freed memory, in bytes.
  • If no memory can be freed, the browser returns 0.

Description

The plug-in calls NPN_MemFlush() when it is not possible to call NPN_MemAlloc(), for example, when calling system APIs that indirectly allocate memory. To request that the browser free as much memory as possible, call NPN_MemFlush() repeatedly until it returns 0.

On the Mac, you can use this method to free memory before calling memory-intensive system calls.

In general, plug-ins should use NPN_MemAlloc() to allocate memory in the browser's memory space, since this function automatically frees cached data if necessary to fulfill the request.

See also

Document Tags and Contributors

 Contributors to this page: teoli, kscarfone, Sheppy, Mook, Pmash
 Last updated by: kscarfone,