|
|||||||||||||
|
|
|
|
|
|
|
|
|
||||||
|
|
|||||||||||||
![]() ![]() ![]() ![]() ![]() ![]() | Allegro Common Lisp FAQ[Last updated on: 2008-04-17T07:35:59+7:00.]
This is a list of frequently asked questions on the use of Allegro Common Lisp. Each question applies to all currently supported Allegro Common Lisp versions unless otherwise noted with version specific information. Likewise with Architecture specific information. Please read this document before sending mail reporting problems to support@franz.com. Periodically, also, some items from this list will be incorporated into our documentation (and dropped from here). Other items stay in the FAQ more or less permanently.
Five most recent FAQ entriesAdministrative IssuesPatchesExpress Edition installation and license file issuesProfessional/Enterprise Edition installation and license file issuesUsing Allegro Common LispHeap placement issuesGarbage CollectionForeign Functions InterfaceCLIM(require :clixm) fails because it can't find libXm.so.3, but I have libXm.so.4 installed. What do I need to do?Composer'Error: "Connection
refused" (errno 111) occurred while creating a local socket and
connecting to a remote host ... on port 6000.'Compatibility between 32 and 64-bit versions of Allegro CLMiscMultiprocessingWindows (architecture specific)Linux (architecture specific)"cannot restore segment prot after reloc: Permission denied". Why?Mac OS X (architecture specific)Using Common Lisp (non-Allegro specific)Administrative IssuesWhat is the current version of Allegro CL?The current version of Allegro CL is 8.1 on all supported platforms. This version was released in August, 2007. Or, 8.1 was released 8/1/2007. How should I report bugs?What should be included in a bug report is described in the section Reporting Bugs in <Allegro directory>/doc/introduction.htm. In short, you should include a transcript that demonstrates the failure and error/result seen. Transcripts can be made in a number of ways, such as from an emacs buffer. A logging facility in Allegro CL is also available. Use the function dribble-bug, To start a session transcript evaluate Once finished, evaluate The header information is generated by a call to the function print-system-state. We prefer not to receive screen shots unless there is no other way to transmit info. Sometimes CL output is not logged in the dribble-bug file. What do I do about this?If you are using dribble-bug to record output note that dribble-bug should only miss output produced when using the foreign-function interface or running a shell function with run-shell-command and friends, or (because it is produced by C code) information printed by the garbage collector during a garbage collection. Some messages from foreign code may be written directly to Unix stdout or stderr, bypassing Lisp entirely. To circumvent this problem, you can either use an Emacs buffer or the Unix utility "script" to save the entire transaction record. Is there a mailing list for Allegro CL? How do I sign up?Yes, there is a mailing list for Allegro CL users. It is accessed through the address allegro-cl@franz.com. To be added to or deleted from this list, send mail to allegro-cl-request@franz.com. Franz periodically makes announcements on this mailing list, but its main purpose is to allow members of the Allegro CL (both Unix and Windows) to communicate with each other, sharing ideas, complaints and code. Note: the mailing list address used to be allegro-cl@cs.berkeley.edu (and requests went to allegro-cl-request@cs.berkeley.edu). Please note that except for spam filtering, the list is uncensored and membership is open to all. Further note that the accuracy of postings made to the list is not guaranteed. Is the ACL documentation available on-line?Yes, at http://www.franz.com/support/documentation/. It is updated from time to time and the instructions for downloading the updated documentation are included in the above link. Are documentation updates available after Allegro CL is released?Our documentation is updated online after release as needed. The updated documentation is available on the Franz Inc. Web and versions are available for downloading. See http://www.franz.com/support/documentation/ for both online documentation and downloadable updates. Does Allegro CL run on operating system X?Our policy of support of Allegro CL on specific operating system versions is as follows: For each released version of Allegro CL, we compose a list of current operating system levels on which we have tested and on which we know our product will work. This list is also located in installation.htm in the section Installation sizes and supported Operating System versions. Because Allegro CL runs on so many different operating systems, and because some of these operating systems have almost infinite combinatorial possibilities, including patches and/or user-modification, we do not attempt to certify Allegro CL on specific operating system versions. Instead, we rely on the tendency of the operating system vendors to maintain upward compatibility, and we usually build on the lowest operating system version for which we have listed support. As long as the operating system is truly upward compatible, Allegro CL should work on the newer versions, and our advice is to try it out. But we also recommend strongly that you run such tests on a machine that is not part of your production process, in case things don't go well. What is the best question to ask of Franz Inc as to my particular operating system and Allegro CL?If the operating system you are interested in running Allegro CL on is the same lineage and the underlying architecture is the same as one which we have already listed as supported, the best question to ask us is
We can answer this question "yes" or "no", which will tell you as the customer whether we have any negative experiences with the operating system version. (The information here may also provide the answer.) If the operating system is very new, the answer to this question might more likely be "no", because the assumption is that the new version is compatible, unless and until it proves otherwise. Other questions that you might ask, if you know that your operating system is very new, are
The fundamental issue with Allegro CL working on a new operating system versions is whether the operating system has any fundamental issues that break Allegro CL. Typically, when the operating system is a natural progression from one which we currently support, we will take specific steps to resolve incompatibilities. Incompatibilities most often occur when an operating system vendor changes the signal-handling interface, usually to be more Posix compliant. The change can break Allegro CL. This has happened in the last several years to Linux, LinuxPPC, FreeBSD, and MacOSX, in that time order. PatchesHow do I install patches?The various processes for installing patches are described at http://www.franz.com/support/patches/ Is there a list of available patches?Yes. In fact, even if you are using sys:update-allegro to download patches, we highly recommend viewing this file periodically so that you are aware of what each patch being downloaded is affecting. Here are the LOG files for each currently supported platform We also provide RSS Feeds to Patch releases for current Allegro CL Versions, and both technical and general announcements. You can check the patch LOG page above periodically or subscribe to one of the RSS feeds to be informed automatically. How do I manually download patches if I am unable to use (sys:update-allegro)?We maintain a publically accessible FTP site from which users can download all available patches. Please visit: ftp://ftp.franz.com/pub/patches/8.1/. From the parent directory, one can also access patches for past versions of Allegro CL. This directory contains a README file with instructions for manually downloading patches toward the bottom of the file. As patches become available, the files in this directory will be updated, so it is a good idea to be aware of when patches are released. The FAQ item here provides information on how you might do so. For a general explanation on how to find and load the patches for your version of Allegro CL see http://www.franz.com/support/patches/. How can I install Allegro CL patches on Windows Vista?Updating patches is a two-step process. First, a user typically calls
the function To install patches first navigate to the Allegro CL start menu and
right-click on the image you'd like to start. Select Run as
administrator. When you select Run as administrator you will need
to answer in the affirmative to the User Account Control dialog
boxes Vista pops up. This will enable you to install the patch files
into To rebuild your images with your current set of patches you must start the cmd.exe program with elevated priviledges, as explained above (that is, navigate to it, bring up the right-click menu, etc.). Then, you should cd to your Allegro directory and run update.exe. If there are no errors during the update process, you have successfully installed the current set of patches. Express Edition installation and license file issues[Express] [Windows] Can I install the Express Edition if I do not have access to the internet?No. Our Windows installer requires access to the Franz Inc. web site (www.franz.com) to be able to retrieve your license file. There is no other way to get the license file. If your goal for installation of the Express Edition is the evaluation of our technology, we will be happy to provide you with an evaluation version of our Professional or Enterprise product, which can be installed without internet access, though email address for the evaluation license file is necessary. Please contact info@franz.com to request your evaluation. [Express] [Windows] The Express does not install--what can I do?As of version 8.x, getting a license file is done by the Express installer. There is no other way to get a license file. Here are the most common causes of problems for the installer retrieving a license file:
[Express] [Linux/FreeBSD/Mac OS X] How do I install the license file?See How do I install the license file below. [Express] [Windows] Is my antivirus software correct that the Express Edition is a virus?No. If you downloaded the software from our web site, we believe your antivirus software is giving you what is called a false positive. OfficeScan from Trend Micro, and other Trend Micro antivirus products have been known at various times to give false positives on Allegro products (not just our Express Edition). [Express] How long can I use the Express Edition?You can use it until the next release of the Express Edition has been out for some time. We usually give Express users 6 months or more to migrate to the new version. [Express] Does the Express Edition expire?Not exactly. The license file does require renewal, but that process is simple, even automatic on Windows. When a new version of Allegro CL is released, we do halt the renewal of Express licenses for older versions and you will be asked to install the most recent Express. [Express] How do I update my license file?Periodically, every 30 days, your license file is updated. You will be asked to update it when it is expired. When it is time to update the license file, you will be asked if you want to update the license file. If you say yes, your license file will be automatically updated. If you require a proxy to access web sites, see this entry. [Express] While updating my license file I get an error: "Unknown host: lfs.franz.com". What do I do?The process of updating the license file must communicate with our web site, and in order for this to work you must be online when the license file is updated. If you are connected to the internet and you get this error, there may be a problem with hostname lookups on your system. Make sure your DNS server is properly configured, asking your Network Administrator for assistance if necessary. If your DNS server is set up correctly, you should be able to:
[Express] How can I update my license file if I require a proxy to access web sites?This is the only case in which updating the license file requires manual intervention. To update your license file, you should run the newlicense program contained in the Allegro directory, like this: newlicense -p proxyhost:proxyport where proxyhost and proxyport are the hostname and port on which your proxy server resides. If your proxy requires a username and password, then the form would be: newlicense -p proxyhost:proxyport -P username:password [Express] Why do I get a "Connection Refused" or "Connection timed out" error when updating my license file?NOTE: Windows Express users cannot use this method because the license file is not stored based on your email address. This problem is most likely to occur because of your firewall or proxy configuration. If you are able to access http://www.franz.com via a browser, try to use the http://www.franz.com/lfs/update-trial-license page for updating as described here. If you continue to have problems, or newlicense reports any errors, please send us email at support@franz.com describing your problem. Please send us the contents of devel.lic in your message. [Express] How do I update my license file if I do not have internet access?Try using http://www.franz.com/lfs/update-trial-license to update your license file instead of newlicense. [Express] When I try to run Allegro CL, a message says my license has expired, but when I run newlicense, it says it is too early to renew. Why might this happen?This can happen when the date on your computer is incorrectly set to a date in the future later than the license expiration date. Allegro CL will not start because it thinks the license has expired. You cannot renew because the Franz Inc. computers (which are presumably set to the correct date) determine it is not time to renew. You can check the date on your computer by looking at the Date/Time entry on the Control Panel. Please consult your Windows documentation for information on resetting the date on your computer. [Express] How do I build mlisp, alisp, or allegro images?Windows: paste this into the Debug window to build one of mlisp.exe or alisp.exe:
;; mlisp: (progn (build-lisp-image "sys:mlisp.dxl" :case-mode :case-sensitive-lower :include-ide nil :restart-app-function nil :restart-init-function nil) (when (probe-file "sys:mlisp.exe") (delete-file "sys:mlisp.exe")) (sys:copy-file "sys:allegro-ansi.exe" "sys:mlisp.exe")) ;; alisp: (progn (build-lisp-image "sys:alisp.dxl" :case-mode :case-insensitive-upper :include-ide nil :restart-app-function nil :restart-init-function nil) (when (probe-file "sys:alisp.exe") (delete-file "sys:alisp.exe")) (sys:copy-file "sys:allegro-ansi.exe" "sys:alisp.exe")) ;; allegro: (progn (build-lisp-image "sys:allegro.dxl" :case-mode :case-sensitive-lower) (when (probe-file "sys:allegro.exe") (delete-file "sys:allegro.exe")) (sys:copy-file "sys:allegro-ansi.exe" "sys:allegro.exe")) UNIX: evaluate the following form to build mlisp image from a running alisp:
(progn (build-lisp-image "sys:mlisp.dxl" :case-mode :case-sensitive-lower :include-ide nil :restart-app-function nil) (when (probe-file "sys:mlisp") (delete-file "sys:mlisp")) (sys:copy-file "sys:alisp" "sys:mlisp")) Evaluating any of the above forms does not add a menu item to the Start Menu. To run the resulting image, you will need to run the executable created in each form. [Express] Is Lisp in a box available with the most recent Express Edition?Yes, here: [Express] After Installation on Windows, I get a "license not found" error. How can I get my license file?When downloading Allegro CL Express Edition for Windows, a single executable, Allegro81installer.exe, downloads, installs, and retrieves the license file that will allow the software to work. If you did not run the Allegro81installer.exe to install the Express Edition, and instead ran acl81_express.exe, you performed a partial installation and must uninstall, then reinstall using the proper executable. If there is a problem in the license retrieval step, please check carefully for any dialogs that indicate failure during the installation process. These messages will provide clues to tracking down various network configuration issues that are covered in other sections of the Express Edition FAQ. If the operating system requested a reboot during the installation process and you opted to Reboot Now, please reinstall and instead choose the Restart Later option. Franz Inc. is unable to generate licenses manually for the Express Edition on Windows. A License must be retrieved via successful completion of the installation program. If the use of the Express Edition is intended as a corporate evaluation of the software, please consider emailing our sales department at sales@franz.com to find out about other ways in which you might demo our software. Professional/Enterprise Edition installation and license file issuesHow do I install the license file?You should have received an email containing a URL from which you can download your license file. (Click here if you haven't received that email or if you have mislaid it. Click here if you cannot access the URL.)
I have misplaced the email telling me the URL from which I can download your license?NOTE: Windows Express users cannot use this method because the license file is not stored based on your email address. We can send the license to you by email. (The link is to http://www.franz.com/lfs/lostlicense and on that page, you are asked for the email address you entered when you requested the license; entering the email address and clicking the Submit button will cause your license file(s) to be emailed to you. Please wait after clicking Submit for the message saying the request was successful. If no license associated with the email address is in the database, the message `No licenses found' is displayed. If that happens, send a message to support@franz.com. Be sure to tell us the email address you used in the body of the message.) I can not access the URL for retrieving my license. What should I do?Typically, this problem occurs because your system is behind a firewall or you must use a proxy server. Our license file server rarely experiences any significant downtime. You should make sure that you should not be using a proxy server to access sites outside of your network and that your browser is configured appropriately. If you do not know if you should be using a proxy server, or don't know what one is, you should check with your Network Administrator for assistance. If your system does not require a proxy server, then perhaps you are behind a firewall that does not give access to certain ports. If the proxy server is not the problem, please email Franz Inc. at support@franz.com stating that you are unable to access the URL for retrieving your license (include the URL), and we will have the license(s) sent to the email under which you have registered. I still have problems with my license file. Can I contact Franz Inc. for assistance?Yes. Questions or problems should be sent to support@franz.com. Please be sure to include the following information:
Using Allegro Common Lisp[Express Edition] Can I use the SSL interface in Allegro CL Express Edition?No. While the SSL module fasl file was included in the Express, it was not intended that the SSL interface be available in the Express Edition. If you have the need for an SSL interface, we gladly urge you to contact us at info@franz.com for an evaluation of our Professional or Enterprise Editions. Why doesn't make-pathname merge the given :directory component with the directory component in :defaults argument?Section 19.4.4 of the ANSI spec says: After the components supplied explicitly by host, device, directory, name, type, and version are filled in, the merging rules used by merge-pathnames are used to fill in any unsupplied components from the defaults supplied by defaults. unsupplied is the crucial word here. By specifying a :directory argument you have supplied the directory component, and the directory component of the :defaults argument is not used. Even specifying :directory nil explicitly supplies a directory component of nil, and this will be treated differently from unsupplied. I am getting stack overflows and occasional Lisp failure when I sort on large arrays. Why and what can I do?Here is a transcript showing a stack overflow. Note that the array has one million (10^6) elements.
USER(1): (setq pippo (make-array 1000000 :initial-element 0)) #(0 0 0 0 0 0 0 0 0 0 ...) USER(2): (sort pippo #'<) Error: Stack overflow (signal 1000) [condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL] Restart actions (select using :continue): 0: continue computation 1: Return to Top Level (an "abort" restart) [1c] USER(3): :pop =================^^^^ USER(4): (sort pippo #'<) #(0 0 0 0 0 0 0 0 0 0 ...) USER(5): Here the computation continues and Lisp exits with a segmentation violation:
USER(1): (setq pippo (make-array 1000000 :initial-element 0)) #(0 0 0 0 0 0 0 0 0 0 ...) USER(2): (sort pippo #'<) Error: Stack overflow (signal 1000) [condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL] Restart actions (select using :continue): 0: continue computation 1: Return to Top Level (an "abort" restart) [1c] USER(3): (sort pippo #'<) Segmentation fault (core dumped) % The stack overflow occurs because a large array is being stack-allocated to perform the sort. The size of the array is architecture dependent; Windows platforms only allocate up to 4 Kbyte arrays on the stack, and normally heap allocate any larger arrays needed, while Unix platforms attempt to allocate 4 Mbyte arrays on the stack. On any architecture, the strategy is programmable; as described below. When the above error occurs, there are several things that can be done.
Just continuing usually works as does, usually, clearing stack with a :reset and retrying. Note, as the second example above shows, trying to redo the sort command in the error prompt (that is, without clearing the error) can result in an abnormal exit from the lisp (Segmentation fault (core dumped) ). This is an unfortunate hole in our stack-overflow detection strategy; Stack overflow is normally detected for every function call, and enough "slop" is allowed for so that functions that allocate an average amount of stack will not cause a hard stack overflow. But if the function allocates large stack objects (such as large temporary vectors) then the jump in stack usage is too much to detect by either the stack cushion or the hardware overflow detection, and stack-overflow death occurs. We hope to guard against such overflow death in some future version of Allegro CL. Sort Strategy: You can tell the system whether to try to stack-allocate things to be sorted. From the documentation in the source code:
;; excl::*simple-vector-sort-strategy*: ;; ;; The sort strategy can be one of three types: ;; :stack - try to allocate stack space for the temp sort; this ;; works easily for 1k elements (4 kbytes), and (on ;; Unix platforms only) for up to 1m elements (4 mbytes) ;; if there is enough stack allocated by the os; more ;; than 1 m elements cause a new svector to be allocated. ;; :alloc - Allocate an svector of size equal to the vector to sort. ;; a new one is allocated each time. ;; <vector> - must be a simple-vector of type t of at least as many ;; elements as are being sorted. During the sort, the global ;; is reset to :alloc so that sort is re-entrant. (defvar excl::*simple-vector-sort-strategy* :stack) I have set the stack cushion (see sys:set-stack-cushion and sys:stack-cushion) to a reasonable value, but the soft stack limit is not being detected, and I get a lisp death instead. Why is that?The stack-cushion (see sys:set-stack-cushion and sys:stack-cushion) is detected in "symbol trampoline", a short piece of code that is used when one Lisp function calls another. It is meant to flag normal situations where stack is growing too quickly, and to signal a condition before a hard stack-size limit is reached. There are several possible situations where the stack-overflow is not detected by this mechanism, and careful thought must be given as to how to handle it:
(defun call-me ( ... ) (declare (notinline call-me)) ... (call-me ...) ... )
Why does it take so long to load a file that interns several thousand symbols in a package?A package has an associated hashtable for the names of symbols in the package. When the size of a package is not specified at creation time, a default hashtable is used. Its initial size is small, allowing for 10 entries, and it tends to grow slowly, growing about 20% each time growth is necessary. Those values are reasonable for most uses, but if you know that a package will have many more symbols, particularly if they will be all created at roughly the same time (as when reading a file that interns thousands of symbols), you should specify the :size keyword argument to defpackage appropriately when creating the package. Thus, if you know the package will eventually have about 4000 symbols, define it with a form like this:
(defpackage :foo (:size 4000) (:use :cl :excl)) Heap placement issuesHow can I specify very large heap sizes for 64-bit versions of Lisp?Something like this will not work of some platforms (64-bit Windows, for example):
(build-lisp-image "new.dxl" :lisp-heap-size (* 1024 1024 1025 15)) Instead of allocating a 15 GB heap, it will allocate something significantly smaller. This is caused because the integer resulting from the multiplication (16,121,856,000) requires more than 32-bits to represent and the ascii to integer conversions on some operating systems do not handle more than 32-bits. Instead, do this:
(build-lisp-image "new.dxl" :lisp-heap-size "15375m") Sometimes Allegro CL, particularly with large images, fail totally with a bus error or a segv. Why might this be happening?In large images, this is occasionally a sign that your system has run out of virtual memory. This can occur on platforms that perform lazy swap allocation, which makes possible the overcommitting of virtual memory. Heap relocation or resizing will not help resolve this issue. Instead, you should:
Sometimes Allegro CL, particularly with large images, run out of memory with a storage-condition. Why might this be happening?The most common cause of this problem is that you've run out of address space for the lisp heap. The first question to ask yourself, as a developer, is: Do I expect my application to consume as much memory at is it? If the question is no, you should determine the cause of the unexpected allocations and resultant heap growth. The Space Analyzer can help you do so. If the answer is yes, then it may be that you need to adjust the locations of the heaps used by Allegro CL. Choosing an adequate location in which to map the Lisp and foreign (C) heaps in a running Lisp image is complex. We refer to these problems collectively as the heap placement problem. While these problems are not in fact new, they are only triggered when the Lisp image is large (typically greater than 500 Mbytes). Continue reading the questions below for advice on how to proceed. How is heap placement determined and what can go wrong?When Allegro CL starts up, space must be found for the following:
If you use 32 bit addressing (as Allegro CL does on most platforms), there are potentially 4 GB of address space. However, most operating systems only allow 31 bit addresses, so only 2 GB are really available. Locations near address 0 (the bottom) are usually reserved by the operating system. Therefore, Allegro CL usually tries to start at some OS-dependent location, typically around 0x20000000, so there is potentially a 1.6 GB block above that. This is plenty for an application that uses less than, say, 0.5 GB, but as the application grows to, say, 1.5 GB, finding enough space becomes problematic. Assuming no intervening shared libraries or other allocated regions in the process address space, you can determine your maximum lisp heap in an image by subtracting the lisp-heap-start (lisp base) from the c-heap-start (c base). Lisp is given an idea of how much heap space it will need to operate via the lisp-heap-size argument to build-lisp-image. This value does not describe the extent of the heap in use, rather it indicates a guaranteed size to which the heap should be able to grow. When building large images on 32-bit platforms, process address space is at a premium and will typically be exhausted long before physical RAM or Virtual Memory is consumed. It is important, therefore, to find and claim a suitable block of address space for application needs. The claiming--via mmap(), specifically--of reserved growth space for the heap has differing behavior under different operating systems. For systems that support the MAP_NORESERVE flag or perform lazy allocation, a lisp-heap-size'd block of address space will be claimed without any resultant mapping to virtual memory (until it is actually used). For other platforms a request for address space will also claim an equivalent amount of virtual memory. Currently, out of all supported Allegro CL platforms, only Tru64 and HP-UX 10.20 meet this latter criteria. So, what might go wrong when Allegro CL starts up? The following might be problems:
Even though this problem may affect any user of Allegro CL or an Allegro CL application, it is mostly a problem with developers of programs which will be distributed to a user base. Users who have an Allegro CL distribution and use a particular machine can, perhaps with trial and error (and perhaps with assistance from Franz Inc.), figure out how to build an image that will work on that machine. But VAR's, say, who are preparing a distribution requiring large images which will be sent to many customers, each of whom may have a different machine configuration and different programs running, may find it difficult to produce a single image suitable for all potential users on a particular platform. Programmers can affect heap placements using these arguments to build-lisp-image:
Improvements in heap location management made available starting in release 5.0.1 make the successful mapping of large images more likely, and make the providing of one image for all users on a particular platform easier to solve. But, any application that uses most of the available address space is in danger of running into machine constraints which make the application fail. How does Lisp start up, in terms of shared-library linking and loading?This is a complicated answer. We start with some terminology:
The Startup Process:
Now, there is a potential problem with the last step. If
then it is conceivable that there will be no swap left for the loading of the user libraries. In this situation, it would be best for the executable to be programmed to pre-load the user librar(y/ies) so that the space is pre-allocated. (You do this by writing a customized main() that loads the needed libraries, see main.htm) But this presents the possibility that the user library might break up the contiguous address space for the Lisp heap, especially on Windows. The problem in intractable in general, but solvable in individual cases. How can I tell where my image's heaps are located, and what size they are?The ansi standard function room can be used for this. A description of the output generated by this function is described in section 2.4 Getting information on memory management using cl:room of gc.htm. Knowledge of your heap locations is necessary to make use of the below suggestions for finding room for larger heaps or for relocating DLLs so they don't interfere with your heap growth. Likewise, if you are interested in increasing your heap size, you should have an idea of how much space you want based on your application requirements. How can I tell what addresses are being used in my process space?There is a C function in the lisp: void memory_status_dump(char *file); If you define a foreign call to this function and then call it while the lisp is running, it will give you a dump of every address in the process, and its status. A string argument will dump the input to the given file, whereas an argument of 0 will write to stdout. For example, on Solaris the output would like look:
Mappings: 52, from struct prmap_t in sys/procfs.h: 0x00000000 - 0x0000ffff 65536 free 0x00010000 - 0x00017fff 32768 ---r-x offset = 0 0x00018000 - 0x00025fff 57344 free 0x00026000 - 0x00029fff 16384 ---rwx offset = 24576 0x0002a000 - 0x00033fff 40960 -b-rwx offset = 0 0x00034000 - 0x03ffffff 66895872 free 0x04000000 - 0x04705fff 7364608 ---rwx offset = 24576 0x04706000 - 0x04771fff 442368 ---rwx offset = 0 0x04772000 - 0x04899fff 1212416 ---rwx offset = 7389184 0x0489a000 - 0x04a49fff 1769472 ---rwx offset = 0 0x04a4a000 - 0x53ffffff 1331388416 free 0x54000000 - 0x54005fff 24576 ---rwx offset = 9093120 0x54006000 - 0xfe6fffff 2859442176 free 0xfe700000 - 0xfe7a7fff 688128 ---r-x offset = 0 0xfe7a8000 - 0xfe7b5fff 57344 free 0xfe7b6000 - 0xfe7bffff 40960 ---rwx offset = 679936 0xfe7c0000 - 0xfe7d7fff 98304 ---rwx offset = 0 0xfe7d8000 - 0xfe801fff 172032 free 0xfe802000 - 0xfe803fff 8192 ---rwx offset = 0 0xfe804000 - 0xfe903fff 1048576 free 0xfe904000 - 0xfe905fff 8192 ---rwx offset = 0 0xfe906000 - 0xfea05fff 1048576 free 0xfea06000 - 0xfea07fff 8192 ---rwx offset = 0 0xfea08000 - 0xfeb07fff 1048576 free 0xfeb08000 - 0xfeb09fff 8192 ---rwx offset = 0 0xfeb0a000 - 0xfec09fff 1048576 free 0xfec0a000 - 0xfec0bfff 8192 ---rwx offset = 0 0xfec0c000 - 0xfed0bfff 1048576 free 0xfed0c000 - 0xfed0dfff 8192 ---rwx offset = 0 0xfed0e000 - 0xfee0dfff 1048576 free 0xfee0e000 - 0xfee0ffff 8192 ---rwx offset = 0 0xfee10000 - 0xfef0bfff 1032192 free 0xfef0c000 - 0xfef0dfff 8192 ---rwx offset = 0 0xfef0e000 - 0xfef0ffff 8192 free 0xfef10000 - 0xfef11fff 8192 ---rwx offset = 0 0xfef12000 - 0xff00dfff 1032192 free 0xff00e000 - 0xff00ffff 8192 ---rwx offset = 0 0xff010000 - 0xff0bffff 720896 free 0xff0c0000 - 0xff0ddfff 122880 ---r-x offset = 0 0xff0de000 - 0xff0ebfff 57344 free 0xff0ec000 - 0xff0effff 16384 ---rwx offset = 114688 0xff0f0000 - 0xff0f9fff 40960 ---rwx offset = 0 0xff0fa000 - 0xff0fffff 24576 free 0xff100000 - 0xff1a3fff 671744 ---r-x offset = 0 0xff1a4000 - 0xff1b1fff 57344 free 0xff1b2000 - 0xff1b9fff 32768 ---rwx offset = 663552 0xff1ba000 - 0xff1bbfff 8192 ---rwx offset = 0 0xff1bc000 - 0xff1e3fff 163840 free 0xff1e4000 - 0xff1e5fff 8192 ---rwx offset = 0 0xff1e6000 - 0xff1effff 40960 free 0xff1f0000 - 0xff1f3fff 16384 ---r-x offset = 0 0xff1f4000 - 0xff1fffff 49152 free 0xff200000 - 0xff27ffff 524288 ---r-x offset = 0 0xff280000 - 0xff28dfff 57344 free 0xff28e000 - 0xff297fff 40960 ---rwx offset = 516096 0xff298000 - 0xff29ffff 32768 ---rwx offset = 0 0xff2a0000 - 0xff2affff 65536 free 0xff2b0000 - 0xff2b1fff 8192 ---rwx offset = 0 0xff2b2000 - 0xff2bffff 57344 free 0xff2c0000 - 0xff2c3fff 16384 ---r-x offset = 0 0xff2c4000 - 0xff2d1fff 57344 free 0xff2d2000 - 0xff2d3fff 8192 ---rwx offset = 8192 0xff2d4000 - 0xff2dffff 49152 free 0xff2e0000 - 0xff2e7fff 32768 ---r-x offset = 0 0xff2e8000 - 0xff2f5fff 57344 free 0xff2f6000 - 0xff2f7fff 8192 ---rwx offset = 24576 0xff2f8000 - 0xff2fffff 32768 free 0xff300000 - 0xff307fff 32768 ---r-x offset = 0 0xff308000 - 0xff315fff 57344 free 0xff316000 - 0xff319fff 16384 ---rwx offset = 24576 0xff31a000 - 0xff31ffff 24576 free 0xff320000 - 0xff321fff 8192 --srwx offset = 0 0xff322000 - 0xff32ffff 57344 free 0xff330000 - 0xff345fff 90112 ---r-x offset = 0 0xff346000 - 0xff353fff 57344 free 0xff354000 - 0xff355fff 8192 ---rwx offset = 81920 0xff356000 - 0xff35ffff 40960 free 0xff360000 - 0xff365fff 24576 ---r-x offset = 0 0xff366000 - 0xff373fff 57344 free 0xff374000 - 0xff375fff 8192 ---rwx offset = 16384 0xff376000 - 0xff37ffff 40960 free 0xff380000 - 0xff387fff 32768 ---r-x offset = 0 0xff388000 - 0xff395fff 57344 free 0xff396000 - 0xff397fff 8192 ---rwx offset = 24576 0xff398000 - 0xff39ffff 32768 free 0xff3a0000 - 0xff3a1fff 8192 ---r-x offset = 0 0xff3a2000 - 0xff3affff 57344 free 0xff3b0000 - 0xff3cdfff 122880 ---r-x offset = 0 0xff3ce000 - 0xff3dbfff 57344 free 0xff3dc000 - 0xff3ddfff 8192 ---rwx offset = 114688 0xff3de000 - 0xff3dffff 8192 ---rwx offset = 0 0xff3e0000 - 0xff443fff 409600 free 0xff444000 - 0xff445fff 8192 ---rwx offset = 0 0xff446000 - 0xffbe5fff 7995392 free 0xffbe6000 - 0xffbeffff 40960 s--rwx offset = 4294942720 Note that each section of memory is grouped by how it is currently mapped; the four characters at the end are flags, with a dash representing not available, and one of r, w, x, and c for read, write, execute and copy-on-write (shared until written, when it will get a private copy). The problem with memory_status_dump is that it doesn't always identify what object is being mapped into any particular address area (such information depends on what's available on a per platform basis). It seems reasonably intuitive what an "object" is by all of the maps on all architectures; each address range constitutes one mapping. However, it is impossible to tell what the objects actually are, and sometimes when two address ranges are exactly adjacent to each other, the higher address range is likely an extension of the lower address range. This is important in deciding what objects to try to identify when deciding how to move things around. For example, if the C heap starts at 0x54000000 and the map has two ranges next to each other, one from 0x54000000 to 0x54007fff and one from 0x54008000 (i.e 0x54007fff + 1) to 0x5401dfff, then it is likely that the C heap was extended once, and thus that if the C heap is moved it will take care of both address ranges. For x86 windows, we recommend the use of Process Explorer (previously hosted by www.sysinternals.com, but now distributed by Microsoft). This utility provides a lot of information and has a great user interface. It is available for download here. Download and install this program. Then, start Allegro CL and run Process Explorer. This will bring up a dual-paned window, the top half of which will show a list of running processes. Click on `allegro.exe' (or `mlisp.exe' or `alisp.exe'), and in the lower pane you will be shown what objects have been allocated in the processes address space. Some Process Explorer configuration tips:
For other platforms, the situation is more complicated, but there are usually operating system tools for interpreting the data. [Windows only] How do I move DLL in memory so that it doesn't conflict with the Lisp heap?The preferred Lisp heap starting address is 0x20000000 on x86 Windows (the heap grows to higher memory addresses). If, using the Process Explorer program (discussed above, an x86 Windows application), you find that the Lisp heap cannot grow to the size that you desire because of a DLL that is in the way, you can use the `editbin' program from Microsoft Visual C++ to move the default base address of the DLL. For example, if foo.dll is in a bad location, according to Process Explorer, and you found foo.dll to live in the c:\winnt\system32 directory, then at a DOS prompt type (assuming 0x65000000 is the beginning of a free address range large enough to accomodate the DLL):
cd c:\winnt\system32 editbin foo.dll /rebase:base=0x65000000 and the next time Lisp starts up, Windows will try to locate foo.dll at 0x65000000 instead of the previous inconvenient address that interfered with the Lisp heap. Note that you may need to disable related programs or boot into safe mode in order to perform this operation. It is generally not possible to modify such files when they are active and loaded into a process address space. Note that the base address for a DLL is only advisory; if the space is already used, Windows will locate it to some other location. By right-clicking on a DLL and selecting "Quick View" (if Quick View support is installed), you can see (among other things) the base address currently assigned to the DLL. What does the "Temporarily scaling back lisp reserved region from XXX to YYY bytes." mean?It means that some other program has grabbed part of the address space that Lisp intended to use. This message is much more common on Windows, where various programs can grab predefined address ranges in all running programs. The Iomega Zip/Jaz tools and PGP are two programs known to do this. There are four things that you can do to handle this situation:
The arguments to build-lisp-image that you will need to specify are :lisp-heap-start, :lisp-heap-size, :c-heap-size and :c-heap-start. What should I know when choosing non-default heap locations?Both the Lisp and C heap must remain in one individual contiguous piece. (i.e a single contiguous lisp heap, and a separate single, contiguous C heap). You need to find a large enough gap in the address space to cover all growth expectations of your application. Most 'large' apps need lots of room for the lisp heap to grow and very little for the C heap. Your mileage may vary. On Unix platforms, the OS allocates memory in the sbrk region, which typically resides directly after the mapped location of the lisp executable. If you restrict this region too much, you run the risk of causing your application to fail with an "unable to allocate memory" error that will usually crash the lisp. This malloc region is used by low level OS system calls and typically by any foreign libraries included in your application. Combined with the knowledge of your current heap locations and sizes, you can use memory-status-dump (see earlier question) to find free regions in the process address space. How do I build an image with non-default heap sizes and/or locations?The typical way to build new images is via the function build-lisp-image. It accepts the following four keyword arguments that are used to relocate the lisp and c heaps from their default locations and sizes:
The following two keyword arguments let you further shape the lisp heap once it has been allocated.
Once you have chosen values for these parameters (see previous questions in this section for help doing so), simply include them in your call to build-lisp-image. When starting the new image, a call to room should show that the lisp heaps have been relocated. How do I build default images provided by Franz with non-default heap sizes and/or locations?A common problem with developers of 'large' applications is that default development images such as alisp.dxl and allegro.dxl are built with default heap locations. Further, even if developers customize the heap locations and sizes of these apps, their changes are undone when they update patches and run update.sh or update.exe. To this end, we have added the following environment variables that build-lisp-image will check for when creating a new image.
Arguments values should use lisp hex notation (#x). It is recommended that users not modify their general development environment when making use of these environment variables as that can result in undue confusion and unexpected results. Instead, it is recommended that a new script (or batch) file be created with a name not used by Allegro CL, such as 'my-update.sh' or 'my-update.bat', which invokes update.sh or update.exe depending on the platform. This script file can then set these environment variables as desired before invoking the Franz provided update script. The user then need only remember to run their personalized update script and their heap settings should persist even when patches are updated. Can I specify heap locations and/or sizes when starting lisp?No. The C heap in particular is not relocatable, so this approach is not feasible. The Lisp heap is relocatable--and occasionally will shrink if the reserve space is not available--but due to the C heap restriction, the only option would be to lower it in memory. This being only half a possible solution, we have not opened up this limited functionality. Garbage CollectionMy memory gobbling loop causes the gc to perform badly. Why?The loop you are running is likely not releasing any bytes of heap for the amount it is allocating. A loop similar to
(compile (defun gobble () (loop for x from 1 to 1000000000000000000000000 with k = 0 do (incf k) (when (= k 10000000) (print ".") (setq k 0)) collect x))) (gobble) is likely generating almost no garbage. Allegro CL's garbage collector makes decisions about how much space to allocate based on the gsgc-parameters that are currently set, and the effect of this loop is to throw the calculations into a non-linear area where the only thing it can do is to cause the heap to grow at a huge rate of increase. Most real programs never run this way; either they don't cons at all, or at least some of the consing done is ephemeral, even if only a few percent of the total consing. And, of course, any program which continues to cons permanent space should be considered leaky, unless it is explicitly a test to gobble up all of memory, and to see how such gobbling progresses. To get better gobbling behavior, allocate at least some of the space in such a way that it becomes garbage. This allows the gc to operate in a more natural manner, and will cause a smoother transition toward the inevitable heap-exhaustion:
(compile (defun gobble2 () (loop for x from 1 to 1000000000000000000000000 with k = 0 do (incf k) (when (= k 10000000) (print ".") (setq k 0)) (when (zerop (mod k 10)) (cons x nil)) ; waste a cons collect x))) (gobble2) Finally: the reason why heap grows so quickly is because newspace must hold all of the objects that have been allocated until they are to be tenured, even though it is known that none of them will die, and so the newspace must continually grow to hold the new allocations as well as the objects waiting to be tenured. An explicit gc with tenuring periodically will serve to flush the newspace out, and will also keep it to a reasonable size, thus making the march toward heap-exhaustion even more smooth:
(compile (defun gobble3 () (loop for x from 1 to 1000000000000000000000000 with k = 0 do (incf k) (when (= k 10000000) (print ".") (setq k 0) (gc :tenure)) ; clear newspace (when (zerop (mod k 10)) (cons x nil)) ; waste a cons collect x))) (gobble3) Foreign Functions InterfaceHow do I pass and return 64-bit integers through the FFI?Allegro CL does not support 64-bit integers in 32-bit lisps, since we try to be compatible on all architectures on which we run, and since there are so many different extensions to C to allow for 64-bit integers, which are of course longer than a "long" type. You can work around this by defining a struct containing two 32-bit values
(def-foreign-type unsignedlonglong (:struct (high :unsigned-int) (low :unsigned-int))) (defun unsignedlonglong-value (x) (+ (ash (fslot-value-typed 'unsignedlonglong nil x 'high) 32) (fslot-value-typed 'unsignedlonglong nil x 'low))) When you define your foreign function, have it return the struct, rather than the integer, and have the lisp reconstruct the number using the function above. You can then have the lisp reconstruct the number using the function above. For passing 64-bit values, you can write a routine to pack 64-bit values into the struct. The struct returned should be passed to the foreign function call.
(defun value-unsignedlonglong (x) (let ((inst (ff:allocate-fobject 'unsignedlonglong))) (setf (ff:fslot-value-typed 'unsignedlonglong nil inst 'high) (ash x -32) (ff:fslot-value-typed 'unsignedlonglong nil inst 'low) (logand x #xffffffff)) inst)) The above code could be further generalized to allow for multiple allocation types. Users are cautioned to be careful not to introduce memory leaks into their application. CLIMHow can I replace the lesstif installed with RedHat Linux 7.2 with openmotif (required for CLIM)?This question is answered here, in the Linux (architecture specific) section. A
|