Top
Back: 5.1.70 maxideal
Forward: 5.1.72 minbase
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.1 Functions
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.1.71 memory

Syntax:

memory ( int_expression )

Type:

int

Purpose:

returns statistics concerning the memory management:

  • memory(0) is the number of active (used) bytes,
  • memory(1) is the number of bytes allocated from the operating system,
  • memory(2) is the maximal number of bytes ever allocated from the operating system during the current SINGULAR session.
Note:

To monitor the memory usage during ongoing computations the option mem should be set (using the command option(mem);, see also option).

Example:
 
  ring r=0,(x(1..500)),dp;
  poly p=(x(1)+x(500))^50;
  proc ReportMemoryUsage()
  {  "Memory currently used by SINGULAR     :",memory(0),"Byte (",
     memory(0)/1023, "KByte)" +newline+
     "Memory currently allocated from system:",memory(1), "Byte (",
     memory(1)/1023, "KByte)";
     "Maximal memory allocated from system  :",memory(2), "Byte (",
     memory(2)/1023, "KByte)";
  }
  ReportMemoryUsage();
→ Memory currently used by SINGULAR     : 206940 Byte ( 202 KByte)
→ Memory currently allocated from system: 669128 Byte ( 654 KByte)
→ Maximal memory allocated from system  : 669128 Byte ( 654 KByte)
  kill p;
  ReportMemoryUsage(); // less memory used: p killed
→ Memory currently used by SINGULAR     : 153704 Byte ( 150 KByte)
→ Memory currently allocated from system: 669128 Byte ( 654 KByte)
→ Maximal memory allocated from system  : 669128 Byte ( 654 KByte)
  kill r;
  ReportMemoryUsage(); // even less memory: r killed
→ Memory currently used by SINGULAR     : 143124 Byte ( 139 KByte)
→ Memory currently allocated from system: 669128 Byte ( 654 KByte)
→ Maximal memory allocated from system  : 669128 Byte ( 654 KByte)

See option; system.


Top Back: 5.1.70 maxideal Forward: 5.1.72 minbase FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.1 Functions Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.