×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi Walden,
Come to think of it... Can I save a pointer to memory in a userspace?
And if so, is that pointer valid in another job? If so, can I even
rely on an endjob to reclaim the memory?
the endjob would indeed reclaim the memory. (as would rclactgrp)
It's theoretically possible to put a pointer in a user space and share
it with another job, but doing so is dangerous for this very reason...
if the job that allocated the memory ends, the pointer will point to
unreserved memory, and produce the same sorts of "unpredictable results"
that you'd have with a buffer overflow.
If you truly want to have a pointer ot memory that's shared across
multiple jobs, there are two much safer ways:
a) Instead of pointing to allocated memory, have the pointer point to a
user space (one that's not in QTEMP) that can persist despite a job ending.
b) Or, use the shared memory APIs (shmget, shmat, shmdt, etc) to reserve
shared memory.
Of course, any time you use memory that can be accessed simultaneously
by two things (either by multi-threaded access or multi-job access) you
need to make sure that you synchronize the memory access properly....
But, hopefully, this sort of thing doesn't come up too often in business
programming!
As an Amazon Associate we earn from qualifying purchases.