[Cuis-dev] Cuis web package

Mark Volkmann r.mark.volkmann at gmail.com
Wed Jun 12 11:22:35 PDT 2024


On Wed, Jun 12, 2024 at 11:04 AM Mark Volkmann <r.mark.volkmann at gmail.com>
wrote:

> What can I do to prevent the `WebServer` instance from being garbage
> collected?
> I thought this would work:
>
> - make `server` be an instance variable of my `MyWebServer` class
> - set that variable in the `initialize` method of that class to a new
> instance of `WebServer`
> - create an instance of `MyWebServer` in a Workspace like this:
>
> server := MyWebServer new.
>
> That did not work. It seems the instance of `WebServer` that is supposedly
> held by the instance of `MyWebServer` still gets GCed.
>
> On Wed, Jun 12, 2024 at 10:23 AM Juan Vuletich <juan at cuis.st> wrote:
>
>> Hi Mark,
>>
>> In Worspaces, variables not declared between vertical vars are "Workspace
>> Variables" and live until the Workspace is closed.
>> In methods, variables declared as temporaries, between vertical vars, may
>> be garbage collected anytime after the method exits, unless there is some
>> other reference to the contents.
>>
>> So, yes. It is very possible that that's the difference.
>>
>
It turns out this isn't a GC issue. After starting the `WebService` once,
if I terminate it from the Process Browser and restart it, it won't work
correctly again.  I have to restart the VM and then start the `WebServer`..
Not sure why. Perhaps terminating the "Webserver's listening process" from
the Process Browser after making code changes in my server code is not the
right approach.

-- 
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240612/f708760c/attachment.htm>


More information about the Cuis-dev mailing list