The subject disclosure relates to tagged integers in connection with conservative garbage collecting for memory management.
By way of background concerning some conventional systems, it is noted that computing devices have traditionally stored information and associated applications. To these ends, implementing an efficient memory management scheme is desirable for achieving increased computing performance. Developments in automatic memory management schemes have been particularly desirable over manual memory management schemes. Garbage collector algorithms, for instance, are automatic memory management schemes which attempt to reclaim memory occupied by objects that are no longer in use by a particular program.
Tracing garbage collectors are the most common type of garbage collector. Tracing garbage collectors first determine which objects are reachable (or potentially reachable), and then discard all remaining objects. A reachable object can be defined as an object for which there exists some variable in the program environment that led to the variable, either directly or through reference from other reachable objects. More precisely, objects are generally reachable in two ways. First, a distinguished set of objects, known as roots, are assumed to be reachable. Typically, these include the objects referenced from anywhere in the call stack (that is, all local variables and parameters in the functions currently being invoked), and any global variables. Second, anything referenced from a reachable object is itself deemed reachable.
A complication with conventional garbage collectors, in languages with both reference types and unboxed value types, is that the garbage collectors distinguish which variables on a call stack are regular values (e.g., integers) and which are references (e.g., pointers). Such distinction would be useful in such systems for distinction purposes since an integer and a reference might otherwise look alike as represented in memory. In this regard, the garbage collector would be able to use the distinction to decide whether to treat a particular element as a reference and follow the reference, or whether it is simply a primitive value.
The above-described deficiencies of today's memory management schemes are merely intended to provide an overview of some of the problems of conventional systems, and are not intended to be exhaustive. Other problems with the state of the art and corresponding benefits of some of the various non-limiting embodiments may become further apparent upon review of the following detailed description.
A simplified summary is provided herein to help enable a basic or general understanding of various aspects of exemplary, non-limiting embodiments that follow in the more detailed description and the accompanying drawings. This summary is not intended, however, as an extensive or exhaustive overview. Instead, the sole purpose of this summary is to present some concepts related to some exemplary non-limiting embodiments in a simplified form as a prelude to the more detailed description of the various embodiments that follow.
In accordance with one or more embodiments and corresponding disclosure, various non-limiting aspects are described in connection with conservative garbage collecting for memory management. In one such aspect, a method for tagging integers within a conservative garbage collecting algorithm is provided. The method can include identifying root objects included in a call stack, which can comprise integer representations and pointer representations. The embodiment can further include tagging the integer representations such that a tagged integer representation is distinguishable from an untagged pointer representation. The method can also include tracing the root objects to a corresponding set of memory locations. For this particular embodiment, a subsequent tracing is performed on the untagged pointer representation, whereas the subsequent tracing is skipped on the tagged integer representation. The method can then further include freeing memory allocated to a set of objects unreachable by the call stack.
In another aspect, a memory management device configured to implement a conservative garbage collecting algorithm with tagged integers is disclosed. Within such embodiment, the memory management device includes a processor configured to execute computer executable components stored in memory. The computer executable components include a scanning component, a tagging component, a tracing component, and a recycling component. The scanning component is configured to identify root objects included in a call stack, which can comprise integer representations and pointer representations. The tagging component is then configured to tag the integer representations such that tagged integer representations are distinguishable from untagged pointer representations, whereas the tracing component is configured to trace the root objects to a corresponding set of memory locations. For this embodiment, the tracing component is configured to perform a subsequent tracing on the untagged pointer representations, wherein the subsequent tracing is skipped on the tagged integer representations. The recycling component is then configured to free memory allocated to a set of objects unreachable by the call stack.
In yet another aspect, a computer-readable storage medium is disclosed for tagging integers within a conservative garbage collecting algorithm. Within such embodiment, the computer-readable storage medium includes computer-readable instructions for causing at least one processor to perform various acts. For instance, such acts include tagging an object graph associated with a call stack, and generating a heap of objects during an execution of the call stack. Here, root objects included in a tagged object graph comprise tagged integer representations and untagged pointer representations, whereas the heap of objects comprises objects included in an executed portion of the call stack. This embodiment further includes tracing unexecuted objects included in an unexecuted portion of the call stack to corresponding memory locations on the heap. For this particular embodiment, a subsequent tracing is performed on the untagged pointer representations and skipped on the tagged integer representations. Memory locations corresponding to unreachable objects on the heap are then cleared, wherein the unreachable objects are unreachable by the unexecuted portion of the call stack.
Other embodiments and various non-limiting examples, scenarios and implementations are described in more detail below.
Various non-limiting embodiments are further described with reference to the accompanying drawings in which:
Overview
As discussed in the background, it is desirable to implement a garbage collector algorithm which distinguishes between integers and pointers on a call stack. In various embodiments, memory management is redesigned around native code compatibility. In an aspect, script objects are less managed objects, and more just native pieces of memory such that reference counting among objects is eliminated. Moreover, a conservative garbage collection algorithm is implemented, where it is not assumed everything that is a pointer is known. With a common language runtime (CLR) garbage collector for instance, the stack is strongly typed. However, with native code, e.g., C code, and script code, one does not know what is on the stack. In this regard, instead of utilizing a reference counting model, it is contemplated that objects are interacted with directly.
The various embodiments disclosed herein are directed towards tagging integers within a conservative garbage collecting algorithm. To this end, it is noted that the aspects disclosed herein facilitate an execution of scripts (e.g., javascripts) against a document object model which is less likely to generate spurious pointers. Moreover, the aspects disclosed herein reduce the probability of spurious pointers since untagged pointers and tagged integers are readily distinguishable.
Tagged Integers and Conservative Garbage Collection
Several issues have arisen as the web browsing experience evolves from a flat presentation of information with minimal interactivity to a richer application or applet experience with lots of interactivity at the client side. More generally, the web browsing experience has evolved into a hybrid of information display and richer interactivity with objects on display. Particular challenges with this evolution are based on adapting the old document object model (DOM), which was originally designed primarily for flat presentation of information based on native code on a client, to an experience that fluidly handles script code, such as javascript objects.
Improving speed is particularly important so as to facilitate a more desirable user experience. For instance, with fly out menus of the past, the web experience flickered with delays based on communications with the server. Scripts, however, enable small programs to modify the DOM on the fly without going back to the server. As people want to do more on the fly without returning to the server, making script code execute fast has become a challenge.
Since the user experience is largely influenced by effectively scripting the DOM, it is desirable to change the DOM as fast as possible to maximize the interactive response. Communication between the scripting engines and the native classes of the DOM were poor in the past due to the use of object linking & embedding (OLE) automation including a set of interfaces, e.g., iDispatch, iActiveScript, etc., which make any object scriptable. However, such methods are slow, and thus improvements are desired. Accordingly, the aspects disclosed herein are directed towards improving script execution speed by tagging integers within a conservative garbage collecting algorithm.
In an aspect, memory allocated to script objects comprises storing such objects onto a heap. Referring next to
In this regard, script objects corresponding to integer values can be tagged so that they are readily distinguishable from pointer values. Referring next to
In an aspect, object graph 300 is utilized to determine which objects on heap 320 are reachable by unexecuted call stack portion 310. Namely, root objects included in unexecuted call stack portion 310 are traced to corresponding memory locations in heap 320, wherein root objects corresponding to integer values are tagged. It is then contemplated that a subsequent tracing of root objects is only performed on reachable untagged pointer values to identify reachable objects referenced by those pointer values. Conversely, a subsequent tracing is skipped on reachable tagged integer values. For this particular example, since reachable object 390 is a root object corresponding to a pointer value, it is untagged. Therefore, a subsequent tracing is performed on reachable object 390, which identifies reachable object 380 corresponding to an integer value. A subsequent tracing, however, is skipped on reachable objects 340 and 370 since these are root objects corresponding to tagged integer values.
It is noted that object graph 300 can be utilized to identify objects unreachable by unexecuted call stack portion 310. In this particular example, unreachable objects 350 and 360 are deemed unreachable since they do not correspond to root objects in unexecuted call stack portion 310, nor are they referenced by a reachable pointer object.
Upon identifying unreachable objects, memory allocated to such objects can be cleared. Referring next to
Referring next to
In one aspect, processor component 510 is configured to execute computer-readable instructions related to performing any of a plurality of functions. Processor component 510 can be a single processor or a plurality of processors dedicated to analyzing information to be communicated from memory management unit 500 and/or generating information that can be utilized memory component 520, scanning component 530, tagging component 540, tracing component 550, and/or recycling component 560. Additionally or alternatively, processor component 510 can be configured to control one or more components of memory management unit 500.
In another aspect, memory component 520 is coupled to processor component 510 and configured to store computer-readable instructions executed by processor component 510. Memory component 520 can also be configured to store any of a plurality of other types of data including data generated by any of scanning component 530, tagging component 540, tracing component 550, and/or recycling component 560. Memory component 520 can be configured in a number of different configurations, including as random access memory, battery-backed memory, hard disk, magnetic tape, etc. Various features can also be implemented upon memory component 520, such as compression and automatic back up, e.g., use of a Redundant Array of Independent Drives configuration.
As illustrated, memory management unit 500 can also include scanning component 530. Within such embodiment, scanning component 530 is configured to identify root objects included in a call stack, which comprise integer representations and pointer representations. Here, it is contemplated that such a call stack is associated with a script executed against a particular object model. For instance, the call stack can be associated with a compilation of a javascript, which facilitates modifying a document object model during runtime.
Memory management unit 500 can further include tagging component 540, as illustrated, which is configured to tag the integer representations included in the call stack. Here, it is noted that the tagging of integers is performed such that tagged integer representations are readily distinguishable from untagged pointer representations. To this end, it is further noted that tagging component 540 can be configured to tag integers in any of a plurality of ways. For instance, tagging component 540 can be configured to transform the integer representations into a different data structure. In a particular embodiment, such transformation can include having tagging component 540 configured to dedicate at least one bit in the different data structure to a tag.
In an aspect, memory management device 500 further includes tracing component 550. Within such embodiment, tracing component 550 is configured to trace the root objects identified by scanning component 530 to a corresponding set of memory locations. After an initial tracing of the root objects, it is contemplated that a subsequent tracing of related objects is performed. In a particular embodiment, however, the subsequent tracing is only performed on the untagged pointer representations and skipped on the tagged integer representations.
In a further aspect, memory management device 500 also includes recycling component 560, which is configured to free memory allocated to a set of objects unreachable by the call stack. In a particular embodiment, recycling component 560 can be configured to place objects called by the call stack onto a heap. Within such embodiment, recycling component 560 can then be further configured to initiate a garbage collection algorithm based on whether a size of the heap exceeds a threshold. In another embodiment, recycling component 560 can be configured to respectively preserve reachable objects in original storage locations of a heap. For example, recycling component 560 can be configured to maintain a separation of heap objects according to a fixed set of boundaries within the heap.
Referring next to
Similar to processor component 510 in memory management unit 500, processor component 710 is configured to execute computer-readable instructions related to performing any of a plurality of functions. Processor component 710 can be a single processor or a plurality of processors dedicated to analyzing information to be communicated from resource management unit 700 and/or generating information that can be utilized by memory component 720, tagging component 730, heap component 740, tracing component 750, freeing component 760, monitoring component 770, and/or graphing component 780. Additionally or alternatively, processor component 710 can be configured to control one or more components of resource management unit 700.
In another aspect, memory component 720 is coupled to processor component 710 and configured to store computer-readable instructions executed by processor component 710. Memory component 720 can also be configured to store any of a plurality of other types of data including data generated by any of tagging component 730, heap component 740, tracing component 750, freeing component 760, monitoring component 770, and/or graphing component 780. Here, it is noted that memory component 720 is analogous to memory component 520 in memory management unit 500. Accordingly, it can be appreciated that any of the aforementioned features/configurations of memory component 520 are also applicable to memory component 720.
As illustrated, resource management unit 700 can also include tagging component 730. Within such embodiment, tagging component 730 is configured to tag an object graph associated with a call stack. Here, it should be noted that root objects included in a tagged object graph can comprise tagged integer representations and untagged pointer representations. For some embodiments, it should be further noted that resource management unit 700 can also include graphing component 780, which is configured to produce object graphs tagged by tagging component 730.
In an aspect, resource management unit 700 is configured to manage objects included in a heap. To facilitate such management, resource management unit 700 can include heap component 740, which is configured to generate a heap of objects during an execution of the call stack. For this particular embodiment, it is contemplated that this heap of objects can comprise objects included in an executed portion of the call stack.
In another aspect, resource management unit 700 can further include tracing component 750. Within such embodiment, tracing component 750 is configured to trace unexecuted objects included in an unexecuted portion of the call stack to corresponding memory locations on the heap. Here, similar to tracing component 550 in memory management device 500, it is contemplated that tracing component 750 can be configured to perform a subsequent tracing of related objects after an initial tracing of the call stack's root objects. Moreover, it is contemplated that such subsequent tracing is only performed on the untagged pointer representations and skipped on the tagged integer representations.
As illustrated, resource management unit 700 can also include freeing component 760. Within such embodiment, freeing component 760 is configured to clear memory locations corresponding to objects on the heap which are deemed unreachable by the unexecuted portion of the call stack. In an aspect, freeing component 760 can be further configured to respectively preserve a storage of objects reachable by the unexecuted portion of the call stack in their original memory locations within the heap. In another aspect, resource management unit 700 can also include monitoring component 770, which is configured to monitor a size of the heap during execution of the call stack. For this particular embodiment, freeing component 760 can then be configured to trigger a clearing of memory allocated to unreachable objects based on the heap size exceeds a particular threshold.
Exemplary Networked and Distributed Environments
One of ordinary skill in the art can appreciate that the various embodiments for tagging integers within a conservative garbage collecting algorithm described herein can be implemented in connection with any computer or other client or server device, which can be deployed as part of a computer network or in a distributed computing environment, and can be connected to any kind of data store. In this regard, the various embodiments described herein can be implemented in any computer system or environment having any number of memory or storage units, and any number of applications and processes occurring across any number of storage units. This includes, but is not limited to, an environment with server computers and client computers deployed in a network environment or a distributed computing environment, having remote or local storage.
Each computing object or device 910, 912, etc. and computing objects or devices 920, 922, 924, 926, 928, etc. can communicate with one or more other computing objects or devices 910, 912, etc. and computing objects or devices 920, 922, 924, 926, 928, etc. by way of the communications network 940, either directly or indirectly. Even though illustrated as a single element in
There are a variety of systems, components, and network configurations that support distributed computing environments. For example, computing systems can be connected together by wired or wireless systems, by local networks or widely distributed networks. Currently, many networks are coupled to the Internet, which provides an infrastructure for widely distributed computing and encompasses many different networks, though any network infrastructure can be used for exemplary communications made incident to the techniques as described in various embodiments.
Thus, a host of network topologies and network infrastructures, such as client/server, peer-to-peer, or hybrid architectures, can be utilized. In a client/server architecture, particularly a networked system, a client is usually a computer that accesses shared network resources provided by another computer, e.g., a server. In the illustration of
A server is typically a remote computer system accessible over a remote or local network, such as the Internet or wireless network infrastructures. The client process may be active in a first computer system, and the server process may be active in a second computer system, communicating with one another over a communications medium, thus providing distributed functionality and allowing multiple clients to take advantage of the information-gathering capabilities of the server. Any software objects utilized pursuant to the user profiling can be provided standalone, or distributed across multiple computing devices or objects.
In a network environment in which the communications network/bus 940 is the Internet, for example, the computing objects or devices 910, 912, etc. can be Web servers with which the computing objects or devices 920, 922, 924, 926, 928, etc. communicate via any of a number of known protocols, such as HTTP. As mentioned, computing objects or devices 910, 912, etc. may also serve as computing objects or devices 920, 922, 924, 926, 928, etc., or vice versa, as may be characteristic of a distributed computing environment.
As mentioned, various embodiments described herein apply to any device wherein it may be desirable to implement an infrastructure for tagging integers within a conservative garbage collecting algorithm. It is understood, therefore, that handheld, portable and other computing devices and computing objects of all kinds are contemplated for use in connection with the various embodiments described herein, i.e., anywhere that a device may provide some functionality in connection with implementing a conservative garbage collecting algorithm with tagged integers. Accordingly, the below general purpose remote computer described below in
Although not required, any of the embodiments can partly be implemented via an operating system, for use by a developer of services for a device or object, and/or included within application software that operates in connection with the operable component(s). Software may be described in the general context of computer-executable instructions, such as program modules, being executed by one or more computers, such as client workstations, servers or other devices. Those skilled in the art will appreciate that network interactions may be practiced with a variety of computer system configurations and protocols.
With reference to
Computer 1010 typically includes a variety of computer readable media and can be any available media that can be accessed by computer 1010. The system memory 1030 may include computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) and/or random access memory (RAM). By way of example, and not limitation, memory 1030 may also include an operating system, application programs, other program modules, and program data. Software can be embodied on a digital versatile disk (DVD), compact disk (CD), or other removable storage as well.
A user may enter commands and information into the computer 1010 through input devices 1040 A monitor or other type of display device is also connected to the system bus 1021 via an interface, such as output interface 1050. In addition to a monitor, computers may also include other peripheral output devices such as speakers and a printer, which may be connected through output interface 1050.
The computer 1010 may operate in a networked or distributed environment using logical connections to one or more other remote computers, such as remote computer 1070. The remote computer 1070 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, or any other remote media consumption or transmission device, and may include any or all of the elements described above relative to the computer 1010. The logical connections depicted in
As mentioned above, while exemplary embodiments have been described in connection with various computing devices, networks and advertising architectures, the underlying concepts may be applied to any network system and any computing device or system in which it is desirable to manage memory.
There are multiple ways of implementing one or more of the embodiments described herein, e.g., an appropriate API, tool kit, driver code, operating system, control, standalone or downloadable software object, etc. which enables applications and services to use the memory management. Embodiments may be contemplated from the standpoint of an API (or other software object), as well as from a software or hardware object that facilitates provision of memory management in accordance with one or more of the described embodiments. Various implementations and embodiments described herein may have aspects that are wholly in hardware, partly in hardware and partly in software, as well as in software.
The word “exemplary” is used herein to mean serving as an example, instance, or illustration. For the avoidance of doubt, the subject matter disclosed herein is not limited by such examples. In addition, any aspect or design described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects or designs, nor is it meant to preclude equivalent exemplary structures and techniques known to those of ordinary skill in the art. Furthermore, to the extent that the terms “includes,” “has,” “contains,” and other similar words are used in either the detailed description or the claims, for the avoidance of doubt, such terms are intended to be inclusive in a manner similar to the term “comprising” as an open transition word without precluding any additional or other elements.
As mentioned, the various techniques described herein may be implemented in connection with hardware or software or, where appropriate, with a combination of both. As used herein, the terms “component,” “system” and the like are likewise intended to refer to a computer-related entity, either hardware, a combination of hardware and software, software, or software in execution. For example, a component may be, but is not limited to being, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer. By way of illustration, both an application running on computer and the computer can be a component. One or more components may reside within a process and/or thread of execution and a component may be localized on one computer and/or distributed between two or more computers.
The aforementioned systems have been described with respect to interaction between several components. It can be appreciated that such systems and components can include those components or specified sub-components, some of the specified components or sub-components, and/or additional components, and according to various permutations and combinations of the foregoing. Sub-components can also be implemented as components communicatively coupled to other components rather than included within parent components (hierarchical). Additionally, it is noted that one or more components may be combined into a single component providing aggregate functionality or divided into several separate sub-components, and any one or more middle layers, such as a management layer, may be provided to communicatively couple to such sub-components in order to provide integrated functionality. Any components described herein may also interact with one or more other components not specifically described herein but generally known by those of skill in the art.
In view of the exemplary systems described supra, methodologies that may be implemented in accordance with the disclosed subject matter can be appreciated with reference to the flowcharts of the various figures. While for purposes of simplicity of explanation, the methodologies are shown and described as a series of blocks, it is to be understood and appreciated that the claimed subject matter is not limited by the order of the blocks, as some blocks may occur in different orders and/or concurrently with other blocks from what is depicted and described herein. Where non-sequential, or branched, flow is illustrated via flowchart, it can be appreciated that various other branches, flow paths, and orders of the blocks, may be implemented which achieve the same or a similar result. Moreover, not all illustrated blocks may be required to implement the methodologies described hereinafter.
While in some embodiments, a client side perspective is illustrated, it is to be understood for the avoidance of doubt that a corresponding server perspective exists, or vice versa. Similarly, where a method is practiced, a corresponding device can be provided having storage and at least one processor configured to practice that method via one or more components.
While the various embodiments have been described in connection with the preferred embodiments of the various figures, it is to be understood that other similar embodiments may be used or modifications and additions may be made to the described embodiment for performing the same function without deviating there from. Still further, one or more aspects of the above described embodiments may be implemented in or across a plurality of processing chips or devices, and storage may similarly be affected across a plurality of devices. Therefore, the present invention should not be limited to any single embodiment, but rather should be construed in breadth and scope in accordance with the appended claims.
Number | Name | Date | Kind |
---|---|---|---|
5920876 | Ungar et al. | Jul 1999 | A |
5991779 | Bejar | Nov 1999 | A |
6101580 | Agesen et al. | Aug 2000 | A |
6675354 | Claussen | Jan 2004 | B1 |
7062709 | Cheung | Jun 2006 | B2 |
7631024 | Wright | Dec 2009 | B2 |
7730016 | Lee | Jun 2010 | B2 |
20070067372 | Meijer | Mar 2007 | A1 |
20100023884 | Brichford | Jan 2010 | A1 |
20100122157 | Cepero Gonzalez | May 2010 | A1 |
Entry |
---|
Shuo Chen, et al.; Residue Objects: A Challenge to Web Browser Security; Apr. 16, 2010. |
“International Search Report”, Mailed Date: Dec. 26, 2012, Application No. PCT/US2012/032639, Filed Date: Apr. 6, 2012, pp. 1-8. |
Number | Date | Country | |
---|---|---|---|
20120271866 A1 | Oct 2012 | US |