Common Language Infrastructure (CLJ) has been introduced as a core technology of Microsoft .NET. It enables "writing in multiple languages, running in multiple platforms" by providing Virtual Execution System (VES), Common Intermediate Language, and Common Type System etc. The advantages of using CLI, including portability, compactness, and interoperability, could benefit the productivity of application software development and deployment. However, for embedded real-time systems, the applications' time-constraints cannot be satisfied easily due to several features of CLI runtime environment, such as thread priority, thread scheduling, garbage collection etc. In this paper, we aim to have a garbage collection mechanism applicable on real-time applications in CLI and other virtual machine environments. We achieve the goal by making the pause time of garbage collection operations predictable, and the invocation of garbage collection and applications schedulable. A cost model based on measured WCET is established to predict the execution time and overhead of garbage collection operations.