Hi, Is it possible to unload a lisp from memory ? if yes, how ? Thanks
(defun yourfunction () .........) (setq yourfunction nil) gc is a function to force "garbage collection", a recovery process. I typically do not remove the functions. Each time a drawing is closed, the functions associated with that namespace are deleted. Regards, Doug
Marcel Assume a function like this: (defun C:MyTest () (princ "\nTest...") (princ) ) Command: MyTest Test... Command: (setq C:MyTest nil) Command: MyTest ; Error: no function definition: C:MYTEST (gc) Forces a garbage collection, witch frees up unused nodes Cheers
I found a way to obtain a list of all my functions. After that, I use (foreach FUNCTION FUNCTIONS_LIST (setq FUNCTION nil) ) But it doesn't work because the function names are strings and it should not be a string. How can I convert it to not be a string ?
Marcel From AutoCAD Developer Help: atoms-family Returns a list of the currently defined symbols (atoms-family format [symlist]) Arguments format An integer value of 0 or 1 that determines the format in which atoms-family returns the symbol names: 0 Return the symbol names as a list 1 Return the symbol names as a list of strings symlist : A list of strings that specify the symbol names you want atoms-family to search for. Return Values A list of symbols. If you specify symlist, then atoms-family returns the specified symbols that are currently defined, and returns nil for those symbols that are not defined. Examples Command: (atoms-family 0) (BNS_PRE_SEL FITSTR2LEN C:AI_SPHERE ALERT DEFUN C:BEXTEND REM_GROUP B_RESTORE_SYSVARS BNS_CMD_EXIT LISPED FNSPLITL... The following code verifies that the symbols CAR, CDR, and XYZ are defined, and returns the list as strings: Command: (atoms-family 1 '("CAR" "CDR" "XYZ")) ("CAR" "CDR" nil) The return value shows that the symbol XYZ is not defined. Cheers
(setq c:mylisp nil) or (setq mylisp nil) (gc) - Forces a garbage collection, which frees up unused memory - re: the documentation.
As mentioned the disable a function from memory it would be as mentioned. (setq function1 nil) And as mentioned (gc) is garbage collection. Autocad has a reserved node space for autolisp functions, which may greater or less than a few 1000, depending on defined functions and floating variables. Which is why you must make sure to control the amount of lisp files that are being loaded. Alternatively you may create VLX files that are external function so that you don't overload autocads node space, if memory serves right. Occationally you may have problems opening large files, or even recovering files do too very little node space, in which case you may perform a (repeat 10 (gc)) to free up some memory. -- AUTODESK Authorized Developer http://www.Cadentity.com MASi