× 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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.